From d9466a5f6b0ed3895184b5b030f2fd42933810e7 Mon Sep 17 00:00:00 2001 From: Vaibhav Dighe <86607407+V-R-Dighe@users.noreply.github.com> Date: Thu, 8 Sep 2022 00:35:43 +0530 Subject: [PATCH] Added support for JXS file format (#319) * Added support for JXS file formats * Revert formatting change made in #319 Co-authored-by: Gabriel Vasile --- internal/magic/image.go | 2 ++ supported_mimes.md | 1 + tree.go | 3 ++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/magic/image.go b/internal/magic/image.go index 8094ffd6..0eb7e95f 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}) + // Jxs matches a JPEG XS coded image file (ISO/IEC 21122-3). + Jxs = prefix([]byte{0x00, 0x00, 0x00, 0x0C, 0x4A, 0x58, 0x53, 0x20, 0x0D, 0x0A, 0x87, 0x0A}) // Jxr matches Microsoft HD JXR photo file. Jxr = prefix([]byte{0x49, 0x49, 0xBC, 0x01}) ) diff --git a/supported_mimes.md b/supported_mimes.md index d5020b98..cdec4e67 100644 --- a/supported_mimes.md +++ b/supported_mimes.md @@ -46,6 +46,7 @@ Extension | MIME type | Aliases **.jp2** | image/jp2 | - **.jpf** | image/jpx | - **.jpm** | image/jpm | video/jpm +**.jxs** | image/jxs | - **.gif** | image/gif | - **.webp** | image/webp | - **.exe** | application/vnd.microsoft.portable-executable | - diff --git a/tree.go b/tree.go index c98b75c9..253bd006 100644 --- a/tree.go +++ b/tree.go @@ -18,7 +18,7 @@ import ( var root = newMIME("application/octet-stream", "", func([]byte, uint32) bool { return true }, xpm, sevenZ, zip, pdf, fdf, ole, ps, psd, p7s, ogg, png, jpg, jxl, jp2, jpx, - jpm, gif, webp, exe, elf, ar, tar, xar, bz2, fits, tiff, bmp, ico, mp3, flac, + jpm, jxs, gif, webp, exe, elf, ar, tar, xar, bz2, fits, tiff, bmp, ico, mp3, flac, midi, ape, musePack, amr, wav, aiff, au, mpeg, quickTime, mqv, mp4, webM, threeGP, threeG2, avi, flv, mkv, asf, aac, voc, aMp4, m4a, m3u, m4v, rmvb, gzip, class, swf, crx, ttf, woff, woff2, otf, ttc, eot, wasm, shx, dbf, dcm, rar, @@ -122,6 +122,7 @@ var ( jpx = newMIME("image/jpx", ".jpf", magic.Jpx) jpm = newMIME("image/jpm", ".jpm", magic.Jpm). alias("video/jpm") + jxs = newMIME("image/jxs", ".jxs", magic.Jxs) xpm = newMIME("image/x-xpixmap", ".xpm", magic.Xpm) bpg = newMIME("image/bpg", ".bpg", magic.Bpg) gif = newMIME("image/gif", ".gif", magic.Gif)