diff --git a/go.mod b/go.mod index 278a6d75a..a2c56836d 100644 --- a/go.mod +++ b/go.mod @@ -22,7 +22,7 @@ require ( github.com/dhowden/tag v0.0.0-20240417053706-3d75831295e8 github.com/dutchcoders/go-clamd v0.0.0-20170520113014-b970184f4d9e github.com/egirna/icap-client v0.1.1 - github.com/gabriel-vasile/mimetype v1.4.6 + github.com/gabriel-vasile/mimetype v1.4.7 github.com/ggwhite/go-masker v1.1.0 github.com/go-chi/chi/v5 v5.1.0 github.com/go-chi/render v1.0.3 diff --git a/go.sum b/go.sum index 23ce286f7..02df7c369 100644 --- a/go.sum +++ b/go.sum @@ -334,8 +334,8 @@ github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMo github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= -github.com/gabriel-vasile/mimetype v1.4.6 h1:3+PzJTKLkvgjeTbts6msPJt4DixhT4YtFNf1gtGe3zc= -github.com/gabriel-vasile/mimetype v1.4.6/go.mod h1:JX1qVKqZd40hUPpAfiNTe0Sne7hdfKSbOqqmkq8GCXc= +github.com/gabriel-vasile/mimetype v1.4.7 h1:SKFKl7kD0RiPdbht0s7hFtjl489WcQ1VyPW8ZzUMYCA= +github.com/gabriel-vasile/mimetype v1.4.7/go.mod h1:GDlAgAyIRT27BhFl53XNAFtfjzOkLaF35JdEG0P7LtU= github.com/gdexlab/go-render v1.0.1 h1:rxqB3vo5s4n1kF0ySmoNeSPRYkEsyHgln4jFIQY7v0U= github.com/gdexlab/go-render v1.0.1/go.mod h1:wRi5nW2qfjiGj4mPukH4UV0IknS1cHD4VgFTmJX5JzM= github.com/getkin/kin-openapi v0.13.0/go.mod h1:WGRs2ZMM1Q8LR1QBEwUxC6RJEfaBcD0s+pcEVXFuAjw= diff --git a/vendor/github.com/gabriel-vasile/mimetype/internal/magic/binary.go b/vendor/github.com/gabriel-vasile/mimetype/internal/magic/binary.go index 96040e6c1..769732018 100644 --- a/vendor/github.com/gabriel-vasile/mimetype/internal/magic/binary.go +++ b/vendor/github.com/gabriel-vasile/mimetype/internal/magic/binary.go @@ -23,6 +23,8 @@ var ( Torrent = prefix([]byte("d8:announce")) // PAR1 matches a parquet file. Par1 = prefix([]byte{0x50, 0x41, 0x52, 0x31}) + // CBOR matches a Concise Binary Object Representation https://cbor.io/ + CBOR = prefix([]byte{0xD9, 0xD9, 0xF7}) ) // Java bytecode and Mach-O binaries share the same magic number. @@ -34,7 +36,7 @@ func classOrMachOFat(in []byte) bool { return false } - return bytes.HasPrefix(in, []byte{0xCA, 0xFE, 0xBA, 0xBE}) + return binary.BigEndian.Uint32(in) == macho.MagicFat } // Class matches a java class file. @@ -44,7 +46,7 @@ func Class(raw []byte, limit uint32) bool { // MachO matches Mach-O binaries format. func MachO(raw []byte, limit uint32) bool { - if classOrMachOFat(raw) && raw[7] < 20 { + if classOrMachOFat(raw) && raw[7] < 0x14 { return true } @@ -156,11 +158,11 @@ func Marc(raw []byte, limit uint32) bool { // the GL transmission Format (glTF). // GLB uses little endian and its header structure is as follows: // -// <-- 12-byte header --> -// | magic | version | length | -// | (uint32) | (uint32) | (uint32) | -// | \x67\x6C\x54\x46 | \x01\x00\x00\x00 | ... | -// | g l T F | 1 | ... | +// <-- 12-byte header --> +// | magic | version | length | +// | (uint32) | (uint32) | (uint32) | +// | \x67\x6C\x54\x46 | \x01\x00\x00\x00 | ... | +// | g l T F | 1 | ... | // // Visit [glTF specification] and [IANA glTF entry] for more details. // @@ -172,14 +174,15 @@ var Glb = prefix([]byte("\x67\x6C\x54\x46\x02\x00\x00\x00"), // TzIf matches a Time Zone Information Format (TZif) file. // See more: https://tools.ietf.org/id/draft-murchison-tzdist-tzif-00.html#rfc.section.3 // Its header structure is shown below: -// +---------------+---+ -// | magic (4) | <-+-- version (1) -// +---------------+---+---------------------------------------+ -// | [unused - reserved for future use] (15) | -// +---------------+---------------+---------------+-----------+ -// | isutccnt (4) | isstdcnt (4) | leapcnt (4) | -// +---------------+---------------+---------------+ -// | timecnt (4) | typecnt (4) | charcnt (4) | +// +// +---------------+---+ +// | magic (4) | <-+-- version (1) +// +---------------+---+---------------------------------------+ +// | [unused - reserved for future use] (15) | +// +---------------+---------------+---------------+-----------+ +// | isutccnt (4) | isstdcnt (4) | leapcnt (4) | +// +---------------+---------------+---------------+ +// | timecnt (4) | typecnt (4) | charcnt (4) | func TzIf(raw []byte, limit uint32) bool { // File is at least 44 bytes (header size). if len(raw) < 44 { diff --git a/vendor/github.com/gabriel-vasile/mimetype/supported_mimes.md b/vendor/github.com/gabriel-vasile/mimetype/supported_mimes.md index 042a5aa7e..a45a3021b 100644 --- a/vendor/github.com/gabriel-vasile/mimetype/supported_mimes.md +++ b/vendor/github.com/gabriel-vasile/mimetype/supported_mimes.md @@ -1,4 +1,4 @@ -## 176 Supported MIME types +## 177 Supported MIME types This file is automatically generated when running tests. Do not edit manually. Extension | MIME type | Aliases @@ -79,7 +79,7 @@ Extension | MIME type | Aliases **.avif** | image/avif | - **.3gp** | video/3gpp | video/3gp, audio/3gpp **.3g2** | video/3gpp2 | video/3g2, audio/3gpp2 -**.mp4** | audio/mp4 | audio/x-m4a, audio/x-mp4a +**.mp4** | audio/mp4 | audio/x-mp4a **.mqv** | video/quicktime | - **.m4a** | audio/x-m4a | - **.m4v** | video/x-m4v | - @@ -118,6 +118,7 @@ Extension | MIME type | Aliases **.mobi** | application/x-mobipocket-ebook | - **.lit** | application/x-ms-reader | - **.bpg** | image/bpg | - +**.cbor** | application/cbor | - **.sqlite** | application/vnd.sqlite3 | application/x-sqlite3 **.dwg** | image/vnd.dwg | image/x-dwg, application/acad, application/x-acad, application/autocad_dwg, application/dwg, application/x-dwg, application/x-autocad, drawing/dwg **.nes** | application/vnd.nintendo.snes.rom | - @@ -162,7 +163,7 @@ Extension | MIME type | Aliases **.xfdf** | application/vnd.adobe.xfdf | - **.owl** | application/owl+xml | - **.php** | text/x-php | - -**.js** | application/javascript | application/x-javascript, text/javascript +**.js** | text/javascript | application/x-javascript, application/javascript **.lua** | text/x-lua | - **.pl** | text/x-perl | - **.py** | text/x-python | text/x-script.python, application/x-python diff --git a/vendor/github.com/gabriel-vasile/mimetype/tree.go b/vendor/github.com/gabriel-vasile/mimetype/tree.go index aa7c8cdba..771e302bc 100644 --- a/vendor/github.com/gabriel-vasile/mimetype/tree.go +++ b/vendor/github.com/gabriel-vasile/mimetype/tree.go @@ -21,7 +21,7 @@ var root = newMIME("application/octet-stream", "", 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, mp4, webM, avi, flv, mkv, asf, aac, voc, m3u, rmvb, gzip, class, swf, crx, ttf, woff, - woff2, otf, ttc, eot, wasm, shx, dbf, dcm, rar, djvu, mobi, lit, bpg, + woff2, otf, ttc, eot, wasm, shx, dbf, dcm, rar, djvu, mobi, lit, bpg, cbor, sqlite3, dwg, nes, lnk, macho, qcp, icns, hdr, mrc, mdb, accdb, zstd, cab, rpm, xz, lzip, torrent, cpio, tzif, xcf, pat, gbr, glb, cabIS, jxr, parquet, // Keep text last because it is the slowest check. @@ -87,8 +87,8 @@ var ( html = newMIME("text/html", ".html", magic.HTML) php = newMIME("text/x-php", ".php", magic.Php) rtf = newMIME("text/rtf", ".rtf", magic.Rtf).alias("application/rtf") - js = newMIME("application/javascript", ".js", magic.Js). - alias("application/x-javascript", "text/javascript") + js = newMIME("text/javascript", ".js", magic.Js). + alias("application/x-javascript", "application/javascript") srt = newMIME("application/x-subrip", ".srt", magic.Srt). alias("application/x-srt", "text/x-srt") vtt = newMIME("text/vtt", ".vtt", magic.Vtt) @@ -156,7 +156,7 @@ var ( aac = newMIME("audio/aac", ".aac", magic.AAC) voc = newMIME("audio/x-unknown", ".voc", magic.Voc) aMp4 = newMIME("audio/mp4", ".mp4", magic.AMp4). - alias("audio/x-m4a", "audio/x-mp4a") + alias("audio/x-mp4a") m4a = newMIME("audio/x-m4a", ".m4a", magic.M4a) m3u = newMIME("application/vnd.apple.mpegurl", ".m3u", magic.M3u). alias("audio/mpegurl") @@ -261,4 +261,5 @@ var ( jxr = newMIME("image/jxr", ".jxr", magic.Jxr).alias("image/vnd.ms-photo") parquet = newMIME("application/vnd.apache.parquet", ".parquet", magic.Par1). alias("application/x-parquet") + cbor = newMIME("application/cbor", ".cbor", magic.CBOR) ) diff --git a/vendor/modules.txt b/vendor/modules.txt index faf27874e..d10d8d363 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -812,7 +812,7 @@ github.com/felixge/httpsnoop # github.com/fsnotify/fsnotify v1.7.0 ## explicit; go 1.17 github.com/fsnotify/fsnotify -# github.com/gabriel-vasile/mimetype v1.4.6 +# github.com/gabriel-vasile/mimetype v1.4.7 ## explicit; go 1.20 github.com/gabriel-vasile/mimetype github.com/gabriel-vasile/mimetype/internal/charset