Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUGFIX] MIME Type Filter #1419

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

fschoelzel
Copy link
Contributor

@fschoelzel fschoelzel commented Dec 30, 2024

Fix Mime Type Filter using File Extension instead of mimetype description out of METS/MODS.
Because of inconsistent use of MIME Type description in METS mets:fileSec.
For Example: image/jpg - which is not an allowed MIME Type according to iana (www.iana.org)

see: https://api.deutsche-digitale-bibliothek.de/items/72OLPWCWDFDG7AVAYDDVJGMYRMZWBHDR/source/record

@sebastian-meyer sebastian-meyer added the 🐛 bug A non-security related bug. label Feb 1, 2025
@sebastian-meyer
Copy link
Member

Technically this is fine, but I am not sure if it's a good idea to allow invalid MIME types (by ignoring them). People should better fix their METS files instead...
Also, image servers like Cantaloupe don't necessarily provide file extensions, because the file type can be specified by parameter. So some image server links won't have file extensions at all while others may have misleading extension (like "jp2", although the actual graphic is png-encoded).

Are invalid MIME types a common problem in METS files? Otherwise I'd prefer asking the "Bibliothek der Friedrich-Ebert-Stiftung" to fix their files.

@sebastian-meyer
Copy link
Member

Any news on this, @fschoelzel?

@fschoelzel
Copy link
Contributor Author

fschoelzel commented Feb 19, 2025

Technically this is fine, but I am not sure if it's a good idea to allow invalid MIME types (by ignoring them). People should better fix their METS files instead... Also, image servers like Cantaloupe don't necessarily provide file extensions, because the file type can be specified by parameter. So some image server links won't have file extensions at all while others may have misleading extension (like "jp2", although the actual graphic is png-encoded).

Are invalid MIME types a common problem in METS files? Otherwise I'd prefer asking the "Bibliothek der Friedrich-Ebert-Stiftung" to fix their files.

As of my short research, the <mets:file ID="xxx" MIMETYPE="image/jpg"> is very often.
(f.e. https://api.deutsche-digitale-bibliothek.de/2/items/I7O7SOUZMYOUIZ2NF6AHQV4ONJ3Y2XDB/source/record)
Thanks for the hints, i didn't thought of this cases. I will change it back to check for the MIMETYPE out of the METS Files.
And, because it is very often, add an exception for image/jpg and hope for correct METS Files in the Future.

What do you think @sebastian-meyer ?

@sebastian-meyer
Copy link
Member

Yes, that's reasonable! Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug A non-security related bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants