Skip to content

Commit a86966a

Browse files
dijotmathewsgabriel-vasile
andauthoredSep 3, 2022
add jxr support #155 (#312)
* add jxr support * test passing * changes suggest * Fix small typo in comment Co-authored-by: Gabriel Vasile <gabriel.vasile@email.com>
1 parent e7130b0 commit a86966a

File tree

5 files changed

+7
-2
lines changed

5 files changed

+7
-2
lines changed
 

‎internal/magic/image.go

+2
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ var (
4444
Hdr = prefix([]byte("#?RADIANCE\n"))
4545
// Xpm matches X PixMap image data.
4646
Xpm = prefix([]byte{0x2F, 0x2A, 0x20, 0x58, 0x50, 0x4D, 0x20, 0x2A, 0x2F})
47+
// Jxr matches Microsoft HD JXR photo file.
48+
Jxr = prefix([]byte{0x49, 0x49, 0xBC, 0x01})
4749
)
4850

4951
func jpeg2k(sig []byte) Detector {

‎mimetype_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ var files = map[string]string{
9393
"jpg.jpg": "image/jpeg",
9494
"jpm.jpm": "image/jpm",
9595
"jxl.jxl": "image/jxl",
96+
"jxr.jxr": "image/jxr",
9697
"xpm.xpm": "image/x-xpixmap",
9798
"js.js": "application/javascript",
9899
"json.json": "application/json",

‎supported_mimes.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## 171 Supported MIME types
1+
## 172 Supported MIME types
22
This file is automatically generated when running tests. Do not edit manually.
33

44
Extension | MIME type | Aliases
@@ -139,6 +139,7 @@ Extension | MIME type | Aliases
139139
**.glb** | model/gltf-binary | -
140140
**.avif** | image/avif | -
141141
**.cab** | application/x-installshield | -
142+
**.jxr** | image/jxr | image/vnd.ms-photo
142143
**.txt** | text/plain | -
143144
**.html** | text/html | -
144145
**.svg** | image/svg+xml | -

‎testdata/jxr.jxr

44.3 KB
Binary file not shown.

‎tree.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ var root = newMIME("application/octet-stream", "",
2424
gzip, class, swf, crx, ttf, woff, woff2, otf, ttc, eot, wasm, shx, dbf, dcm, rar,
2525
djvu, mobi, lit, bpg, sqlite3, dwg, nes, lnk, macho, qcp, icns, heic,
2626
heicSeq, heif, heifSeq, hdr, mrc, mdb, accdb, zstd, cab, rpm, xz, lzip,
27-
torrent, cpio, tzif, xcf, pat, gbr, glb, avif, cabIS,
27+
torrent, cpio, tzif, xcf, pat, gbr, glb, avif, cabIS, jxr,
2828
// Keep text last because it is the slowest check
2929
text,
3030
)
@@ -255,4 +255,5 @@ var (
255255
gbr = newMIME("image/x-gimp-gbr", ".gbr", magic.Gbr)
256256
xfdf = newMIME("application/vnd.adobe.xfdf", ".xfdf", magic.Xfdf)
257257
glb = newMIME("model/gltf-binary", ".glb", magic.Glb)
258+
jxr = newMIME("image/jxr", ".jxr", magic.Jxr).alias("image/vnd.ms-photo")
258259
)

0 commit comments

Comments
 (0)