Skip to content

Conversation

@daniJimen
Copy link
Collaborator

@daniJimen daniJimen commented Nov 21, 2025

Moves the heic cases in the get method to group them with other file types that use an offset match type. This change improves code readability and organization without altering functionality.
ISSUE: #27

Moves the `mp4` and `heic` cases in the `get` method to group them with other file types that use an `offset` match type. This change improves code readability and organization without altering functionality.
Moves `FileMagicNumberType.mp4` and `FileMagicNumberType.heic` to use the `byRange` matching strategy instead of `exact`.

This change groups them with other formats like `webp`, `wav`, and `avi` that already use range-based magic number matching.
@codecov
Copy link

codecov bot commented Nov 21, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (019fc10) to head (b24caa4).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #28   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            4         4           
  Lines           47        45    -2     
=========================================
- Hits            47        45    -2     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Adds a new test to verify that `detectFileTypeFromBytes` correctly identifies a file type based on its initial magic number, even when it contains another file type embedded within it.

Specifically, the test uses a byte slice representing a PDF that contains a JP2 file signature and confirms that it is correctly detected as a PDF.
Adds a new test to verify that `detectFileTypeFromBytes` correctly identifies a file type based on its initial magic number, even when it contains another file type embedded within it.

Specifically, the test uses a byte slice representing a PDF that contains a JP2 file signature and confirms that it is correctly detected as a PDF.
Bumps the version to 1.4.1.

This patch addresses an issue where a PDF file containing a JPEG 2000 (JP2) image was incorrectly identified as a JP2 file.

Changes include:
- Corrected the file type detection logic to properly distinguish between a standalone JP2 file and a PDF embedding a JP2.
- Added a new test case to verify the fix and prevent future regressions for PDFs that contain other file types.
Adds the issue number to the changelog entry for version 1.4.1, referencing the fix for an issue where a PDF containing a JP2 image was incorrectly identified as a JP2 file.
@vicajilau vicajilau merged commit 21b7e9b into main Nov 21, 2025
3 checks passed
@vicajilau vicajilau deleted the feature/issue_embedded_HEIC branch November 21, 2025 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants