diff --git a/internal/magic/image.go b/internal/magic/image.go index 355ad944..8094ffd6 100644 --- a/internal/magic/image.go +++ b/internal/magic/image.go @@ -44,6 +44,8 @@ var ( Hdr = prefix([]byte("#?RADIANCE\n")) // Xpm matches X PixMap image data. Xpm = prefix([]byte{0x2F, 0x2A, 0x20, 0x58, 0x50, 0x4D, 0x20, 0x2A, 0x2F}) + // Jxr matches Microsoft HD JXR photo file. + Jxr = prefix([]byte{0x49, 0x49, 0xBC, 0x01}) ) func jpeg2k(sig []byte) Detector { diff --git a/mimetype_test.go b/mimetype_test.go index cfdde995..3ec861a1 100644 --- a/mimetype_test.go +++ b/mimetype_test.go @@ -93,6 +93,7 @@ var files = map[string]string{ "jpg.jpg": "image/jpeg", "jpm.jpm": "image/jpm", "jxl.jxl": "image/jxl", + "jxr.jxr": "image/jxr", "xpm.xpm": "image/x-xpixmap", "js.js": "application/javascript", "json.json": "application/json", diff --git a/supported_mimes.md b/supported_mimes.md index 83d602d2..d5020b98 100644 --- a/supported_mimes.md +++ b/supported_mimes.md @@ -1,4 +1,4 @@ -## 171 Supported MIME types +## 172 Supported MIME types This file is automatically generated when running tests. Do not edit manually. Extension | MIME type | Aliases @@ -139,6 +139,7 @@ Extension | MIME type | Aliases **.glb** | model/gltf-binary | - **.avif** | image/avif | - **.cab** | application/x-installshield | - +**.jxr** | image/jxr | image/vnd.ms-photo **.txt** | text/plain | - **.html** | text/html | - **.svg** | image/svg+xml | - diff --git a/testdata/jxr.jxr b/testdata/jxr.jxr new file mode 100644 index 00000000..afaaf638 Binary files /dev/null and b/testdata/jxr.jxr differ diff --git a/tree.go b/tree.go index ee6a92bb..c98b75c9 100644 --- a/tree.go +++ b/tree.go @@ -24,7 +24,7 @@ var root = newMIME("application/octet-stream", "", gzip, class, swf, crx, ttf, woff, woff2, otf, ttc, eot, wasm, shx, dbf, dcm, rar, djvu, mobi, lit, bpg, sqlite3, dwg, nes, lnk, macho, qcp, icns, heic, heicSeq, heif, heifSeq, hdr, mrc, mdb, accdb, zstd, cab, rpm, xz, lzip, - torrent, cpio, tzif, xcf, pat, gbr, glb, avif, cabIS, + torrent, cpio, tzif, xcf, pat, gbr, glb, avif, cabIS, jxr, // Keep text last because it is the slowest check text, ) @@ -255,4 +255,5 @@ var ( gbr = newMIME("image/x-gimp-gbr", ".gbr", magic.Gbr) xfdf = newMIME("application/vnd.adobe.xfdf", ".xfdf", magic.Xfdf) glb = newMIME("model/gltf-binary", ".glb", magic.Glb) + jxr = newMIME("image/jxr", ".jxr", magic.Jxr).alias("image/vnd.ms-photo") )