diff --git a/formatscaper/formatscaper.py b/formatscaper/formatscaper.py index 7840737025bbbeae2d5827fc3f5ba0f815b872f6..3b0f99cfd0fd83717fa8811ee33bde1f5f32153b 100755 --- a/formatscaper/formatscaper.py +++ b/formatscaper/formatscaper.py @@ -221,11 +221,16 @@ def process_record_file(record_file: RecordFile) -> None: if match["ns"] == "pronom": format = Format.from_sf_dict(match) + # replace first occurrence of the URI with filename + filename = file_info["filename"].replace( + record_file.uri, record_file.filename, 1 + ) + # the storing of results needs to be mutually exclusive with mutex: format = formats.setdefault(format.puid, format) result = Result( - filename=file_info["filename"], + filename=filename, record=record_file.record, format=format, )