From 3a54026ae05440ae166208b3a8aaaf298c002f7a Mon Sep 17 00:00:00 2001 From: Chris MacDonald <31731869+chrismacdonaldw@users.noreply.github.com> Date: Mon, 29 Jul 2024 11:18:00 -0300 Subject: [PATCH] Add an extension bypass for MODS dsid. --- scripts/datastream_export.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/datastream_export.py b/scripts/datastream_export.py index 78ce767..b45d1cd 100644 --- a/scripts/datastream_export.py +++ b/scripts/datastream_export.py @@ -48,7 +48,7 @@ def fetch_data(dsid, base_url, user, password, output_dir, pid): dsid_dir = os.path.join(output_dir, dsid) os.makedirs(dsid_dir, exist_ok=True) content_type = response.headers.get("Content-Type", "") - extension = mimetypes.guess_extension(content_type) if content_type else "" + extension = ".xml" if dsid == "MODS" else mimetypes.guess_extension(content_type) or "" filename = f"{pid}-{dsid}{extension}" with open(os.path.join(dsid_dir, filename), "wb") as f: f.write(response.content)