Skip to content

fix(cbx-reader): add GIF and BMP to supported image extensions#230

Merged
balazs-szucs merged 1 commit into
grimmory-tools:developfrom
graypawn:fix/cbx-reader-gif-bmp-support
Mar 27, 2026
Merged

fix(cbx-reader): add GIF and BMP to supported image extensions#230
balazs-szucs merged 1 commit into
grimmory-tools:developfrom
graypawn:fix/cbx-reader-gif-bmp-support

Conversation

@graypawn

@graypawn graypawn commented Mar 27, 2026

Copy link
Copy Markdown
Contributor

Description

GIF and BMP images inside CBX archives are not displayed in the web reader. This PR adds support for these formats.

Linked Issue: Fixes #165

Changes

  • Added .gif and .bmp to SUPPORTED_IMAGE_EXTENSIONS in CbxReaderService.java

Test Output

Environment: Docker gradle:9.3.1-jdk25-alpine (same image as project Dockerfile)

> Task :test
3483 tests, 0 failures, 15 ignored
Duration: 11m 7.38s

BUILD SUCCESSFUL in 20m 34s
6 actionable tasks: 6 executed

Verification

Deployed the build on my server and tested with the following CBZ file:

  • format_test.cbz — 8 pages, one per format (JPG, JPEG, PNG, WebP, AVIF, HEIC, GIF, BMP)
    format_test.zip
format_test-1 format_test-2 format_test-3 format_test-4 format_test-5 format_test-6 format_test-7 format_test-8

Summary by CodeRabbit

  • New Features
    • Added support for GIF and BMP image formats in comic book archives. The application now recognizes these formats as valid page images when reading archive files, improving compatibility and expanding the range of image formats that can be used in comic book publications.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Mar 27, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

The CbxReaderService now supports GIF and BMP image formats in CBX archives by extending the SUPPORTED_IMAGE_EXTENSIONS list, enabling these formats to be recognized as valid page images alongside the existing JPG, JPEG, PNG, WebP, AVIF, and HEIC formats.

Changes

Cohort / File(s) Summary
Image Format Support
booklore-api/src/main/java/org/booklore/service/reader/CbxReaderService.java
Extended SUPPORTED_IMAGE_EXTENSIONS array to include .gif and .bmp formats, allowing these image types to be recognized and included in CBX archive page lists.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Suggested labels

backend, enhancement

Poem

🐰 A carrot-colored gift for CBX files so rare,
GIF and BMP now dance with elegant flair,
No longer lost in the archive's deep lair,
Every page format gets equal care! 📚✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The PR title follows conventional commit format with 'fix' type and clear description of the change.
Description check ✅ Passed The PR description follows the template with all required sections: Description, Linked Issue, and Changes. Additional test output and verification sections provide comprehensive context.
Linked Issues check ✅ Passed The code changes directly address issue #165 by adding .gif and .bmp to SUPPORTED_IMAGE_EXTENSIONS, enabling these formats to be displayed in CBX archives.
Out of Scope Changes check ✅ Passed All changes are strictly scoped to the issue: only the SUPPORTED_IMAGE_EXTENSIONS constant was modified in CbxReaderService, with no additional unrelated changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
✨ Simplify code
  • Create PR with simplified code

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@booklore-api/src/main/java/org/booklore/service/reader/CbxReaderService.java`:
- Line 42: The controller currently hardcodes "image/jpeg" when streaming CBX
pages; update the BookMediaController method that serves CBX pages (the handler
around lines 65-76) to derive the actual MIME type from the selected archive
entry (the CBX page entry you obtain via
CbxReaderService/SUPPORTED_IMAGE_EXTENSIONS) and call
response.setContentType(mimeType) before writing the page bytes to the output
stream; ensure the MIME string comes from the archive entry's metadata or by
mapping the entry's file extension to a proper MIME (e.g., via a small helper or
existing mapping) and use that value instead of the fixed "image/jpeg".
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9c338a48-8902-4e68-b3f8-0da15cd5ea6d

📥 Commits

Reviewing files that changed from the base of the PR and between aff1ecb and 0a0c10e.

📒 Files selected for processing (1)
  • booklore-api/src/main/java/org/booklore/service/reader/CbxReaderService.java
📜 Review details
🧰 Additional context used
📓 Path-based instructions (1)
booklore-api/src/**/*.java

📄 CodeRabbit inference engine (AGENTS.md)

booklore-api/src/**/*.java: Use 4-space indentation in Java files and match surrounding Java style
Prefer constructor injection via Lombok patterns already used in the codebase. Do not introduce @Autowired field injection
Use MapStruct for entity/DTO mapping

Files:

  • booklore-api/src/main/java/org/booklore/service/reader/CbxReaderService.java

@balazs-szucs balazs-szucs left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for investigating this, and raising a PR!

@balazs-szucs balazs-szucs merged commit be22f55 into grimmory-tools:develop Mar 27, 2026
1 check passed
zachyale pushed a commit to zachyale/grimmory that referenced this pull request Apr 17, 2026
…ory-tools#230)

Co-authored-by: de.banker <hub9ray@gmail.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
zachyale pushed a commit to zachyale/grimmory that referenced this pull request Apr 17, 2026
…ory-tools#230)

Co-authored-by: de.banker <hub9ray@gmail.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
zachyale pushed a commit that referenced this pull request Apr 17, 2026
Co-authored-by: de.banker <hub9ray@gmail.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
zachyale pushed a commit that referenced this pull request Apr 22, 2026
Co-authored-by: de.banker <hub9ray@gmail.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CBX archives with GIF images show "No pages available"

2 participants