fix(opds): update mime type support for FB2 and CBX formats based on file extension #2077
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🚀 Pull Request
📝 Description
Closes: #2041
IANA deprecated the mimetypes "application/x-cbr" and "application/x-cbz" in 2017 and replaced them with "application/vnd.comicbook-rar" and "application/vnd.comicbook+zip". Newer readers may not recognize the deprecated mimetypes.
This pull request improves how file MIME types are determined and represented for books in the OPDS feed, ensuring they are accurate and standards-compliant. It also introduces comprehensive tests to verify correct MIME type assignment for various book formats.
🛠️ Changes Implemented
MIME type handling improvements:
fileMimeTypemethod inOpdsFeedService.javanow returns fully qualified MIME types (e.g.,"application/pdf","application/epub+zip", etc.) instead of partial or incorrect strings, and provides specific MIME types for additional formats like FB2 and various comic book archives (CBZ, CBR, CB7, CBT).appendLinksmethod is updated to use the correct MIME type directly, removing the redundant"application/"prefix that was previously prepended.Testing improvements:
OpdsFeedServiceMimeTypeTest.javathat thoroughly tests MIME type assignment for all supported book file types, including edge cases for comic book archive extensions.🧪 Testing Strategy
📸 Visual Changes (if applicable)
developbranch./gradlew testfor backend)💬 Additional Context (optional)