Commit 21b7e9b
authored
Refactor: Group mp4 and heic with other offset-based types (#28)
* Refactor: Group mp4 and heic with other offset-based types
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.
* feat: Use byRange matching for mp4 and heic
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.
* feat: Add test case for combined file types
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.
* feat: Add test case for combined file types
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.
* fix: Correctly identify PDFs containing JP2 images
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.
* Fix: Update CHANGELOG for 1.4.1
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.1 parent 019fc10 commit 21b7e9b
File tree
4 files changed
+52
-3
lines changed- lib/src
- test
4 files changed
+52
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
1 | 5 | | |
2 | 6 | | |
3 | 7 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | | - | |
24 | 22 | | |
25 | 23 | | |
26 | 24 | | |
27 | 25 | | |
28 | 26 | | |
29 | 27 | | |
| 28 | + | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
93 | 138 | | |
94 | 139 | | |
95 | 140 | | |
| |||
0 commit comments