Skip to content

[BUGFIX] MIME Type Filter#1419

Merged
sebastian-meyer merged 13 commits intokitodo:mainfrom
fschoelzel:fix-mimtypefilter
Feb 26, 2025
Merged

[BUGFIX] MIME Type Filter#1419
sebastian-meyer merged 13 commits intokitodo:mainfrom
fschoelzel:fix-mimtypefilter

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!

@sebastian-meyer
Copy link
Member

Thank you!

@sebastian-meyer sebastian-meyer merged commit 11e66dd into kitodo:main Feb 26, 2025
6 checks passed
@codecov
Copy link

codecov bot commented Feb 26, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 0.00%. Comparing base (fca97b7) to head (00366a7).
Report is 1 commits behind head on main.

Additional details and impacted files
@@     Coverage Diff      @@
##   main   #1419   +/-   ##
============================
============================

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@fschoelzel fschoelzel deleted the fix-mimtypefilter branch February 26, 2025 16:20
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