Skip to content

Commit

Permalink
Add an extension bypass for MODS dsid.
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismacdonaldw committed Jul 29, 2024
1 parent 49b4be5 commit 3a54026
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/datastream_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 3a54026

Please sign in to comment.