diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml
index 631b26d..73aea3c 100644
--- a/.github/workflows/golangci-lint.yml
+++ b/.github/workflows/golangci-lint.yml
@@ -23,4 +23,4 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v7
with:
- version: v2.4.0
+ version: v2.5.0
diff --git a/Makefile b/Makefile
index 99cc306..8c712a9 100644
--- a/Makefile
+++ b/Makefile
@@ -8,7 +8,7 @@ ifeq ($(RACE),1)
GOFLAGS+=-race
endif
-LINT_VERSION := v2.4.0
+LINT_VERSION := v2.5.0
MAIN := ${NAME}/cmd/${NAME}
diff --git a/go.mod b/go.mod
index 76db92d..8dbb1d8 100644
--- a/go.mod
+++ b/go.mod
@@ -28,7 +28,7 @@ require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/codemodus/kace v0.5.1 // indirect
- github.com/gabriel-vasile/mimetype v1.4.11 // indirect
+ github.com/gabriel-vasile/mimetype v1.4.10 // indirect
github.com/getsentry/sentry-go/echo v0.35.3 // indirect
github.com/go-pg/zerochecker v0.2.0 // indirect
github.com/go-playground/locales v0.14.1 // indirect
@@ -67,7 +67,7 @@ require (
golang.org/x/text v0.31.0 // indirect
golang.org/x/time v0.13.0 // indirect
golang.org/x/tools v0.38.0 // indirect
- google.golang.org/protobuf v1.36.10 // indirect
+ google.golang.org/protobuf v1.36.9 // indirect
mellium.im/sasl v0.3.2 // indirect
)
diff --git a/go.sum b/go.sum
index 8b4625d..89ec6c7 100644
--- a/go.sum
+++ b/go.sum
@@ -31,8 +31,8 @@ github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
-github.com/gabriel-vasile/mimetype v1.4.11 h1:AQvxbp830wPhHTqc1u7nzoLT+ZFxGY7emj5DR5DYFik=
-github.com/gabriel-vasile/mimetype v1.4.11/go.mod h1:d+9Oxyo1wTzWdyVUPMmXFvp4F9tea18J8ufA774AB3s=
+github.com/gabriel-vasile/mimetype v1.4.10 h1:zyueNbySn/z8mJZHLt6IPw0KoZsiQNszIpU+bX4+ZK0=
+github.com/gabriel-vasile/mimetype v1.4.10/go.mod h1:d+9Oxyo1wTzWdyVUPMmXFvp4F9tea18J8ufA774AB3s=
github.com/getsentry/sentry-go v0.36.2 h1:uhuxRPTrUy0dnSzTd0LrYXlBYygLkKY0hhlG5LXarzM=
github.com/getsentry/sentry-go v0.36.2/go.mod h1:p5Im24mJBeruET8Q4bbcMfCQ+F+Iadc4L48tB1apo2c=
github.com/getsentry/sentry-go/echo v0.35.3 h1:aJ0e4kGuH7T1ggAd3LOYwAyQV0bq37AX36vNPr6JYnM=
@@ -373,8 +373,8 @@ google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
-google.golang.org/protobuf v1.36.10 h1:AYd7cD/uASjIL6Q9LiTjz8JLcrh/88q5UObnmY3aOOE=
-google.golang.org/protobuf v1.36.10/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
+google.golang.org/protobuf v1.36.9 h1:w2gp2mA27hUeUzj9Ex9FBjsBm40zfaDtEWow293U7Iw=
+google.golang.org/protobuf v1.36.9/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
diff --git a/vendor/github.com/gabriel-vasile/mimetype/.git-blame-ignore-revs b/vendor/github.com/gabriel-vasile/mimetype/.git-blame-ignore-revs
deleted file mode 100644
index 3892826..0000000
--- a/vendor/github.com/gabriel-vasile/mimetype/.git-blame-ignore-revs
+++ /dev/null
@@ -1,9 +0,0 @@
-# Github is obeying this ignore file by default.
-# Run this command on local to ignore formatting commits in `git blame`
-# git config blame.ignoreRevsFile .git-blame-ignore-revs
-
-# Added a new column to supported_mimes.md
-# The supported_mimes.md file was a nice way to find when a file format was
-# introduced. However, when I changed to add a new column in the table, the
-# whole git blame got poisoned for the file.
-eb497f9bc5d31c6eab2929a112051218670137ba
diff --git a/vendor/github.com/gabriel-vasile/mimetype/README.md b/vendor/github.com/gabriel-vasile/mimetype/README.md
index ea5c89a..f28f56c 100644
--- a/vendor/github.com/gabriel-vasile/mimetype/README.md
+++ b/vendor/github.com/gabriel-vasile/mimetype/README.md
@@ -97,9 +97,7 @@ or from a [file](https://pkg.go.dev/github.com/gabriel-vasile/mimetype#DetectFil
## Contributing
-Contributions are never expected but very much welcome.
-[mimetype_tests](https://github.com/gabriel-vasile/mimetype_tests/actions/workflows/test.yml)
-shows which file formats are most often misidentified and can help prioritise.
-When submitting a PR for detection of a new file format, please make sure to
-add a record to the list of testcases in [mimetype_test.go](mimetype_test.go).
-For complex files a record can be added in the [testdata](testdata) directory.
+Contributions are unexpected but welcome. When submitting a PR for detection of
+a new file format, please make sure to add a record to the list of testcases
+from [mimetype_test.go](mimetype_test.go). For complex files a record can be added
+in the [testdata](testdata) directory.
diff --git a/vendor/github.com/gabriel-vasile/mimetype/internal/charset/charset.go b/vendor/github.com/gabriel-vasile/mimetype/internal/charset/charset.go
index 3373274..8c5a05e 100644
--- a/vendor/github.com/gabriel-vasile/mimetype/internal/charset/charset.go
+++ b/vendor/github.com/gabriel-vasile/mimetype/internal/charset/charset.go
@@ -2,7 +2,6 @@ package charset
import (
"bytes"
- "strings"
"unicode/utf8"
"github.com/gabriel-vasile/mimetype/internal/markup"
@@ -142,25 +141,27 @@ func FromXML(content []byte) string {
return FromPlain(content)
}
func fromXML(s scan.Bytes) string {
- xml := []byte(" 1 && ((raw[0] == 0xFF && raw[1] == 0xF1) || (raw[0] == 0xFF && raw[1] == 0xF9))
-}
+var (
+ // Flac matches a Free Lossless Audio Codec file.
+ Flac = prefix([]byte("\x66\x4C\x61\x43\x00\x00\x00\x22"))
+ // Midi matches a Musical Instrument Digital Interface file.
+ Midi = prefix([]byte("\x4D\x54\x68\x64"))
+ // Ape matches a Monkey's Audio file.
+ Ape = prefix([]byte("\x4D\x41\x43\x20\x96\x0F\x00\x00\x34\x00\x00\x00\x18\x00\x00\x00\x90\xE3"))
+ // MusePack matches a Musepack file.
+ MusePack = prefix([]byte("MPCK"))
+ // Au matches a Sun Microsystems au file.
+ Au = prefix([]byte("\x2E\x73\x6E\x64"))
+ // Amr matches an Adaptive Multi-Rate file.
+ Amr = prefix([]byte("\x23\x21\x41\x4D\x52"))
+ // Voc matches a Creative Voice file.
+ Voc = prefix([]byte("Creative Voice File"))
+ // M3u matches a Playlist file.
+ M3u = prefix([]byte("#EXTM3U"))
+ // AAC matches an Advanced Audio Coding file.
+ AAC = prefix([]byte{0xFF, 0xF1}, []byte{0xFF, 0xF9})
+)
// Mp3 matches an mp3 file.
func Mp3(raw []byte, limit uint32) bool {
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 37ad6a9..70599b3 100644
--- a/vendor/github.com/gabriel-vasile/mimetype/internal/magic/binary.go
+++ b/vendor/github.com/gabriel-vasile/mimetype/internal/magic/binary.go
@@ -6,52 +6,26 @@ import (
"encoding/binary"
)
-// Lnk matches Microsoft lnk binary format.
-func Lnk(raw []byte, _ uint32) bool {
- return bytes.HasPrefix(raw, []byte{0x4C, 0x00, 0x00, 0x00, 0x01, 0x14, 0x02, 0x00})
-}
-
-// Wasm matches a web assembly File Format file.
-func Wasm(raw []byte, _ uint32) bool {
- return bytes.HasPrefix(raw, []byte{0x00, 0x61, 0x73, 0x6D})
-}
-
-// Exe matches a Windows/DOS executable file.
-func Exe(raw []byte, _ uint32) bool {
- return len(raw) > 1 && raw[0] == 0x4D && raw[1] == 0x5A
-}
-
-// Elf matches an Executable and Linkable Format file.
-func Elf(raw []byte, _ uint32) bool {
- return bytes.HasPrefix(raw, []byte{0x7F, 0x45, 0x4C, 0x46})
-}
-
-// Nes matches a Nintendo Entertainment system ROM file.
-func Nes(raw []byte, _ uint32) bool {
- return bytes.HasPrefix(raw, []byte{0x4E, 0x45, 0x53, 0x1A})
-}
-
-// SWF matches an Adobe Flash swf file.
-func SWF(raw []byte, _ uint32) bool {
- return bytes.HasPrefix(raw, []byte("CWS")) ||
- bytes.HasPrefix(raw, []byte("FWS")) ||
- bytes.HasPrefix(raw, []byte("ZWS"))
-}
-
-// Torrent has bencoded text in the beginning.
-func Torrent(raw []byte, _ uint32) bool {
- return bytes.HasPrefix(raw, []byte("d8:announce"))
-}
-
-// PAR1 matches a parquet file.
-func Par1(raw []byte, _ uint32) bool {
- return bytes.HasPrefix(raw, []byte{0x50, 0x41, 0x52, 0x31})
-}
-
-// CBOR matches a Concise Binary Object Representation https://cbor.io/
-func CBOR(raw []byte, _ uint32) bool {
- return bytes.HasPrefix(raw, []byte{0xD9, 0xD9, 0xF7})
-}
+var (
+ // Lnk matches Microsoft lnk binary format.
+ Lnk = prefix([]byte{0x4C, 0x00, 0x00, 0x00, 0x01, 0x14, 0x02, 0x00})
+ // Wasm matches a web assembly File Format file.
+ Wasm = prefix([]byte{0x00, 0x61, 0x73, 0x6D})
+ // Exe matches a Windows/DOS executable file.
+ Exe = prefix([]byte{0x4D, 0x5A})
+ // Elf matches an Executable and Linkable Format file.
+ Elf = prefix([]byte{0x7F, 0x45, 0x4C, 0x46})
+ // Nes matches a Nintendo Entertainment system ROM file.
+ Nes = prefix([]byte{0x4E, 0x45, 0x53, 0x1A})
+ // SWF matches an Adobe Flash swf file.
+ SWF = prefix([]byte("CWS"), []byte("FWS"), []byte("ZWS"))
+ // Torrent has bencoded text in the beginning.
+ 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.
// More info here https://github.com/threatstack/libmagic/blob/master/magic/Magdir/cafebabe
@@ -194,10 +168,8 @@ func Marc(raw []byte, limit uint32) bool {
//
// [glTF specification]: https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html
// [IANA glTF entry]: https://www.iana.org/assignments/media-types/model/gltf-binary
-func GLB(raw []byte, _ uint32) bool {
- return bytes.HasPrefix(raw, []byte("\x67\x6C\x54\x46\x02\x00\x00\x00")) ||
- bytes.HasPrefix(raw, []byte("\x67\x6C\x54\x46\x01\x00\x00\x00"))
-}
+var GLB = prefix([]byte("\x67\x6C\x54\x46\x02\x00\x00\x00"),
+ []byte("\x67\x6C\x54\x46\x01\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
diff --git a/vendor/github.com/gabriel-vasile/mimetype/internal/magic/database.go b/vendor/github.com/gabriel-vasile/mimetype/internal/magic/database.go
index 35c3f91..cb1fed1 100644
--- a/vendor/github.com/gabriel-vasile/mimetype/internal/magic/database.go
+++ b/vendor/github.com/gabriel-vasile/mimetype/internal/magic/database.go
@@ -1,21 +1,13 @@
package magic
-import "bytes"
-
-// Sqlite matches an SQLite database file.
-func Sqlite(raw []byte, _ uint32) bool {
- return bytes.HasPrefix(raw, []byte{
+var (
+ // Sqlite matches an SQLite database file.
+ Sqlite = prefix([]byte{
0x53, 0x51, 0x4c, 0x69, 0x74, 0x65, 0x20, 0x66,
0x6f, 0x72, 0x6d, 0x61, 0x74, 0x20, 0x33, 0x00,
})
-}
-
-// MsAccessAce matches Microsoft Access dababase file.
-func MsAccessAce(raw []byte, _ uint32) bool {
- return offset(raw, []byte("Standard ACE DB"), 4)
-}
-
-// MsAccessMdb matches legacy Microsoft Access database file (JET, 2003 and earlier).
-func MsAccessMdb(raw []byte, _ uint32) bool {
- return offset(raw, []byte("Standard Jet DB"), 4)
-}
+ // MsAccessAce matches Microsoft Access dababase file.
+ MsAccessAce = offset([]byte("Standard ACE DB"), 4)
+ // MsAccessMdb matches legacy Microsoft Access database file (JET, 2003 and earlier).
+ MsAccessMdb = offset([]byte("Standard Jet DB"), 4)
+)
diff --git a/vendor/github.com/gabriel-vasile/mimetype/internal/magic/document.go b/vendor/github.com/gabriel-vasile/mimetype/internal/magic/document.go
index 7208039..7f9308d 100644
--- a/vendor/github.com/gabriel-vasile/mimetype/internal/magic/document.go
+++ b/vendor/github.com/gabriel-vasile/mimetype/internal/magic/document.go
@@ -5,31 +5,14 @@ import (
"encoding/binary"
)
-// Pdf matches a Portable Document Format file.
-// https://github.com/file/file/blob/11010cc805546a3e35597e67e1129a481aed40e8/magic/Magdir/pdf
-func Pdf(raw []byte, _ uint32) bool {
- // usual pdf signature
- return bytes.HasPrefix(raw, []byte("%PDF-")) ||
- // new-line prefixed signature
- bytes.HasPrefix(raw, []byte("\012%PDF-")) ||
- // UTF-8 BOM prefixed signature
- bytes.HasPrefix(raw, []byte("\xef\xbb\xbf%PDF-"))
-}
-
-// Fdf matches a Forms Data Format file.
-func Fdf(raw []byte, _ uint32) bool {
- return bytes.HasPrefix(raw, []byte("%FDF"))
-}
-
-// Mobi matches a Mobi file.
-func Mobi(raw []byte, _ uint32) bool {
- return offset(raw, []byte("BOOKMOBI"), 60)
-}
-
-// Lit matches a Microsoft Lit file.
-func Lit(raw []byte, _ uint32) bool {
- return bytes.HasPrefix(raw, []byte("ITOLITLS"))
-}
+var (
+ // Fdf matches a Forms Data Format file.
+ Fdf = prefix([]byte("%FDF"))
+ // Mobi matches a Mobi file.
+ Mobi = offset([]byte("BOOKMOBI"), 60)
+ // Lit matches a Microsoft Lit file.
+ Lit = prefix([]byte("ITOLITLS"))
+)
// PDF matches a Portable Document Format file.
// The %PDF- header should be the first thing inside the file but many
diff --git a/vendor/github.com/gabriel-vasile/mimetype/internal/magic/font.go b/vendor/github.com/gabriel-vasile/mimetype/internal/magic/font.go
index 857cfcc..43af282 100644
--- a/vendor/github.com/gabriel-vasile/mimetype/internal/magic/font.go
+++ b/vendor/github.com/gabriel-vasile/mimetype/internal/magic/font.go
@@ -4,20 +4,14 @@ import (
"bytes"
)
-// Woff matches a Web Open Font Format file.
-func Woff(raw []byte, _ uint32) bool {
- return bytes.HasPrefix(raw, []byte("wOFF"))
-}
-
-// Woff2 matches a Web Open Font Format version 2 file.
-func Woff2(raw []byte, _ uint32) bool {
- return bytes.HasPrefix(raw, []byte("wOF2"))
-}
-
-// Otf matches an OpenType font file.
-func Otf(raw []byte, _ uint32) bool {
- return bytes.HasPrefix(raw, []byte{0x4F, 0x54, 0x54, 0x4F, 0x00})
-}
+var (
+ // Woff matches a Web Open Font Format file.
+ Woff = prefix([]byte("wOFF"))
+ // Woff2 matches a Web Open Font Format version 2 file.
+ Woff2 = prefix([]byte("wOF2"))
+ // Otf matches an OpenType font file.
+ Otf = prefix([]byte{0x4F, 0x54, 0x54, 0x4F, 0x00})
+)
// Ttf matches a TrueType font file.
func Ttf(raw []byte, limit uint32) bool {
diff --git a/vendor/github.com/gabriel-vasile/mimetype/internal/magic/ftyp.go b/vendor/github.com/gabriel-vasile/mimetype/internal/magic/ftyp.go
index fc642ef..ac72713 100644
--- a/vendor/github.com/gabriel-vasile/mimetype/internal/magic/ftyp.go
+++ b/vendor/github.com/gabriel-vasile/mimetype/internal/magic/ftyp.go
@@ -4,33 +4,24 @@ import (
"bytes"
)
-// AVIF matches an AV1 Image File Format still or animated.
-// Wikipedia page seems outdated listing image/avif-sequence for animations.
-// https://github.com/AOMediaCodec/av1-avif/issues/59
-func AVIF(raw []byte, _ uint32) bool {
- return ftyp(raw, []byte("avif"), []byte("avis"))
-}
-
-// ThreeGP matches a 3GPP file.
-func ThreeGP(raw []byte, _ uint32) bool {
- return ftyp(raw,
+var (
+ // AVIF matches an AV1 Image File Format still or animated.
+ // Wikipedia page seems outdated listing image/avif-sequence for animations.
+ // https://github.com/AOMediaCodec/av1-avif/issues/59
+ AVIF = ftyp([]byte("avif"), []byte("avis"))
+ // ThreeGP matches a 3GPP file.
+ ThreeGP = ftyp(
[]byte("3gp1"), []byte("3gp2"), []byte("3gp3"), []byte("3gp4"),
[]byte("3gp5"), []byte("3gp6"), []byte("3gp7"), []byte("3gs7"),
[]byte("3ge6"), []byte("3ge7"), []byte("3gg6"),
)
-}
-
-// ThreeG2 matches a 3GPP2 file.
-func ThreeG2(raw []byte, _ uint32) bool {
- return ftyp(raw,
+ // ThreeG2 matches a 3GPP2 file.
+ ThreeG2 = ftyp(
[]byte("3g24"), []byte("3g25"), []byte("3g26"), []byte("3g2a"),
[]byte("3g2b"), []byte("3g2c"), []byte("KDDI"),
)
-}
-
-// AMp4 matches an audio MP4 file.
-func AMp4(raw []byte, _ uint32) bool {
- return ftyp(raw,
+ // AMp4 matches an audio MP4 file.
+ AMp4 = ftyp(
// audio for Adobe Flash Player 9+
[]byte("F4A "), []byte("F4B "),
// Apple iTunes AAC-LC (.M4A) Audio
@@ -40,61 +31,33 @@ func AMp4(raw []byte, _ uint32) bool {
// Nero Digital AAC Audio
[]byte("NDAS"),
)
-}
-
-// Mqv matches a Sony / Mobile QuickTime file.
-func Mqv(raw []byte, _ uint32) bool {
- return ftyp(raw, []byte("mqt "))
-}
-
-// M4a matches an audio M4A file.
-func M4a(raw []byte, _ uint32) bool {
- return ftyp(raw, []byte("M4A "))
-}
-
-// M4v matches an Appl4 M4V video file.
-func M4v(raw []byte, _ uint32) bool {
- return ftyp(raw, []byte("M4V "), []byte("M4VH"), []byte("M4VP"))
-}
-
-// Heic matches a High Efficiency Image Coding (HEIC) file.
-func Heic(raw []byte, _ uint32) bool {
- return ftyp(raw, []byte("heic"), []byte("heix"))
-}
-
-// HeicSequence matches a High Efficiency Image Coding (HEIC) file sequence.
-func HeicSequence(raw []byte, _ uint32) bool {
- return ftyp(raw, []byte("hevc"), []byte("hevx"))
-}
-
-// Heif matches a High Efficiency Image File Format (HEIF) file.
-func Heif(raw []byte, _ uint32) bool {
- return ftyp(raw, []byte("mif1"), []byte("heim"), []byte("heis"), []byte("avic"))
-}
-
-// HeifSequence matches a High Efficiency Image File Format (HEIF) file sequence.
-func HeifSequence(raw []byte, _ uint32) bool {
- return ftyp(raw, []byte("msf1"), []byte("hevm"), []byte("hevs"), []byte("avcs"))
-}
-
-// Mj2 matches a Motion JPEG 2000 file: https://en.wikipedia.org/wiki/Motion_JPEG_2000.
-func Mj2(raw []byte, _ uint32) bool {
- return ftyp(raw, []byte("mj2s"), []byte("mjp2"), []byte("MFSM"), []byte("MGSV"))
-}
-
-// Dvb matches a Digital Video Broadcasting file: https://dvb.org.
-// https://cconcolato.github.io/mp4ra/filetype.html
-// https://github.com/file/file/blob/512840337ead1076519332d24fefcaa8fac36e06/magic/Magdir/animation#L135-L154
-func Dvb(raw []byte, _ uint32) bool {
- return ftyp(raw,
+ // Mqv matches a Sony / Mobile QuickTime file.
+ Mqv = ftyp([]byte("mqt "))
+ // M4a matches an audio M4A file.
+ M4a = ftyp([]byte("M4A "))
+ // M4v matches an Appl4 M4V video file.
+ M4v = ftyp([]byte("M4V "), []byte("M4VH"), []byte("M4VP"))
+ // Heic matches a High Efficiency Image Coding (HEIC) file.
+ Heic = ftyp([]byte("heic"), []byte("heix"))
+ // HeicSequence matches a High Efficiency Image Coding (HEIC) file sequence.
+ HeicSequence = ftyp([]byte("hevc"), []byte("hevx"))
+ // Heif matches a High Efficiency Image File Format (HEIF) file.
+ Heif = ftyp([]byte("mif1"), []byte("heim"), []byte("heis"), []byte("avic"))
+ // HeifSequence matches a High Efficiency Image File Format (HEIF) file sequence.
+ HeifSequence = ftyp([]byte("msf1"), []byte("hevm"), []byte("hevs"), []byte("avcs"))
+ // Mj2 matches a Motion JPEG 2000 file: https://en.wikipedia.org/wiki/Motion_JPEG_2000.
+ Mj2 = ftyp([]byte("mj2s"), []byte("mjp2"), []byte("MFSM"), []byte("MGSV"))
+ // Dvb matches a Digital Video Broadcasting file: https://dvb.org.
+ // https://cconcolato.github.io/mp4ra/filetype.html
+ // https://github.com/file/file/blob/512840337ead1076519332d24fefcaa8fac36e06/magic/Magdir/animation#L135-L154
+ Dvb = ftyp(
[]byte("dby1"), []byte("dsms"), []byte("dts1"), []byte("dts2"),
[]byte("dts3"), []byte("dxo "), []byte("dmb1"), []byte("dmpf"),
[]byte("drc1"), []byte("dv1a"), []byte("dv1b"), []byte("dv2a"),
[]byte("dv2b"), []byte("dv3a"), []byte("dv3b"), []byte("dvr1"),
[]byte("dvt1"), []byte("emsg"))
-}
-
-// TODO: add support for remaining video formats at ftyps.com.
+ // TODO: add support for remaining video formats at ftyps.com.
+)
// QuickTime matches a QuickTime File Format file.
// https://www.loc.gov/preservation/digital/formats/fdd/fdd000052.shtml
diff --git a/vendor/github.com/gabriel-vasile/mimetype/internal/magic/image.go b/vendor/github.com/gabriel-vasile/mimetype/internal/magic/image.go
index 788f547..0eb7e95 100644
--- a/vendor/github.com/gabriel-vasile/mimetype/internal/magic/image.go
+++ b/vendor/github.com/gabriel-vasile/mimetype/internal/magic/image.go
@@ -2,127 +2,66 @@ package magic
import "bytes"
-// Png matches a Portable Network Graphics file.
-// https://www.w3.org/TR/PNG/
-func Png(raw []byte, _ uint32) bool {
- return bytes.HasPrefix(raw, []byte{0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A})
-}
-
-// Apng matches an Animated Portable Network Graphics file.
-// https://wiki.mozilla.org/APNG_Specification
-func Apng(raw []byte, _ uint32) bool {
- return offset(raw, []byte("acTL"), 37)
-}
-
-// Jpg matches a Joint Photographic Experts Group file.
-func Jpg(raw []byte, _ uint32) bool {
- return bytes.HasPrefix(raw, []byte{0xFF, 0xD8, 0xFF})
-}
-
-// Jp2 matches a JPEG 2000 Image file (ISO 15444-1).
-func Jp2(raw []byte, _ uint32) bool {
- return jpeg2k(raw, []byte{0x6a, 0x70, 0x32, 0x20})
-}
-
-// Jpx matches a JPEG 2000 Image file (ISO 15444-2).
-func Jpx(raw []byte, _ uint32) bool {
- return jpeg2k(raw, []byte{0x6a, 0x70, 0x78, 0x20})
-}
-
-// Jpm matches a JPEG 2000 Image file (ISO 15444-6).
-func Jpm(raw []byte, _ uint32) bool {
- return jpeg2k(raw, []byte{0x6a, 0x70, 0x6D, 0x20})
-}
-
-// Gif matches a Graphics Interchange Format file.
-func Gif(raw []byte, _ uint32) bool {
- return bytes.HasPrefix(raw, []byte("GIF87a")) ||
- bytes.HasPrefix(raw, []byte("GIF89a"))
-}
-
-// Bmp matches a bitmap image file.
-func Bmp(raw []byte, _ uint32) bool {
- return bytes.HasPrefix(raw, []byte{0x42, 0x4D})
-}
-
-// Ps matches a PostScript file.
-func Ps(raw []byte, _ uint32) bool {
- return bytes.HasPrefix(raw, []byte("%!PS-Adobe-"))
-}
-
-// Psd matches a Photoshop Document file.
-func Psd(raw []byte, _ uint32) bool {
- return bytes.HasPrefix(raw, []byte("8BPS"))
-}
-
-// Ico matches an ICO file.
-func Ico(raw []byte, _ uint32) bool {
- return bytes.HasPrefix(raw, []byte{0x00, 0x00, 0x01, 0x00}) ||
- bytes.HasPrefix(raw, []byte{0x00, 0x00, 0x02, 0x00})
-}
-
-// Icns matches an ICNS (Apple Icon Image format) file.
-func Icns(raw []byte, _ uint32) bool {
- return bytes.HasPrefix(raw, []byte("icns"))
-}
-
-// Tiff matches a Tagged Image File Format file.
-func Tiff(raw []byte, _ uint32) bool {
- return bytes.HasPrefix(raw, []byte{0x49, 0x49, 0x2A, 0x00}) ||
- bytes.HasPrefix(raw, []byte{0x4D, 0x4D, 0x00, 0x2A})
-}
-
-// Bpg matches a Better Portable Graphics file.
-func Bpg(raw []byte, _ uint32) bool {
- return bytes.HasPrefix(raw, []byte{0x42, 0x50, 0x47, 0xFB})
-}
-
-// Xcf matches GIMP image data.
-func Xcf(raw []byte, _ uint32) bool {
- return bytes.HasPrefix(raw, []byte("gimp xcf"))
-}
-
-// Pat matches GIMP pattern data.
-func Pat(raw []byte, _ uint32) bool {
- return offset(raw, []byte("GPAT"), 20)
-}
-
-// Gbr matches GIMP brush data.
-func Gbr(raw []byte, _ uint32) bool {
- return offset(raw, []byte("GIMP"), 20)
-}
-
-// Hdr matches Radiance HDR image.
-// https://web.archive.org/web/20060913152809/http://local.wasp.uwa.edu.au/~pbourke/dataformats/pic/
-func Hdr(raw []byte, _ uint32) bool {
- return bytes.HasPrefix(raw, []byte("#?RADIANCE\n"))
-}
-
-// Xpm matches X PixMap image data.
-func Xpm(raw []byte, _ uint32) bool {
- return bytes.HasPrefix(raw, []byte{0x2F, 0x2A, 0x20, 0x58, 0x50, 0x4D, 0x20, 0x2A, 0x2F})
-}
-
-// Jxs matches a JPEG XS coded image file (ISO/IEC 21122-3).
-func Jxs(raw []byte, _ uint32) bool {
- return bytes.HasPrefix(raw, []byte{0x00, 0x00, 0x00, 0x0C, 0x4A, 0x58, 0x53, 0x20, 0x0D, 0x0A, 0x87, 0x0A})
-}
-
-// Jxr matches Microsoft HD JXR photo file.
-func Jxr(raw []byte, _ uint32) bool {
- return bytes.HasPrefix(raw, []byte{0x49, 0x49, 0xBC, 0x01})
-}
-
-func jpeg2k(raw []byte, sig []byte) bool {
- if len(raw) < 24 {
- return false
- }
+var (
+ // Png matches a Portable Network Graphics file.
+ // https://www.w3.org/TR/PNG/
+ Png = prefix([]byte{0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A})
+ // Apng matches an Animated Portable Network Graphics file.
+ // https://wiki.mozilla.org/APNG_Specification
+ Apng = offset([]byte("acTL"), 37)
+ // Jpg matches a Joint Photographic Experts Group file.
+ Jpg = prefix([]byte{0xFF, 0xD8, 0xFF})
+ // Jp2 matches a JPEG 2000 Image file (ISO 15444-1).
+ Jp2 = jpeg2k([]byte{0x6a, 0x70, 0x32, 0x20})
+ // Jpx matches a JPEG 2000 Image file (ISO 15444-2).
+ Jpx = jpeg2k([]byte{0x6a, 0x70, 0x78, 0x20})
+ // Jpm matches a JPEG 2000 Image file (ISO 15444-6).
+ Jpm = jpeg2k([]byte{0x6a, 0x70, 0x6D, 0x20})
+ // Gif matches a Graphics Interchange Format file.
+ Gif = prefix([]byte("GIF87a"), []byte("GIF89a"))
+ // Bmp matches a bitmap image file.
+ Bmp = prefix([]byte{0x42, 0x4D})
+ // Ps matches a PostScript file.
+ Ps = prefix([]byte("%!PS-Adobe-"))
+ // Psd matches a Photoshop Document file.
+ Psd = prefix([]byte("8BPS"))
+ // Ico matches an ICO file.
+ Ico = prefix([]byte{0x00, 0x00, 0x01, 0x00}, []byte{0x00, 0x00, 0x02, 0x00})
+ // Icns matches an ICNS (Apple Icon Image format) file.
+ Icns = prefix([]byte("icns"))
+ // Tiff matches a Tagged Image File Format file.
+ Tiff = prefix([]byte{0x49, 0x49, 0x2A, 0x00}, []byte{0x4D, 0x4D, 0x00, 0x2A})
+ // Bpg matches a Better Portable Graphics file.
+ Bpg = prefix([]byte{0x42, 0x50, 0x47, 0xFB})
+ // Xcf matches GIMP image data.
+ Xcf = prefix([]byte("gimp xcf"))
+ // Pat matches GIMP pattern data.
+ Pat = offset([]byte("GPAT"), 20)
+ // Gbr matches GIMP brush data.
+ Gbr = offset([]byte("GIMP"), 20)
+ // Hdr matches Radiance HDR image.
+ // https://web.archive.org/web/20060913152809/http://local.wasp.uwa.edu.au/~pbourke/dataformats/pic/
+ 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})
+)
+
+func jpeg2k(sig []byte) Detector {
+ return func(raw []byte, _ uint32) bool {
+ if len(raw) < 24 {
+ return false
+ }
- if !bytes.Equal(raw[4:8], []byte{0x6A, 0x50, 0x20, 0x20}) &&
- !bytes.Equal(raw[4:8], []byte{0x6A, 0x50, 0x32, 0x20}) {
- return false
+ if !bytes.Equal(raw[4:8], []byte{0x6A, 0x50, 0x20, 0x20}) &&
+ !bytes.Equal(raw[4:8], []byte{0x6A, 0x50, 0x32, 0x20}) {
+ return false
+ }
+ return bytes.Equal(raw[20:24], sig)
}
- return bytes.Equal(raw[20:24], sig)
}
// Webp matches a WebP file.
@@ -169,20 +108,3 @@ func Jxl(raw []byte, _ uint32) bool {
return bytes.HasPrefix(raw, []byte{0xFF, 0x0A}) ||
bytes.HasPrefix(raw, []byte("\x00\x00\x00\x0cJXL\x20\x0d\x0a\x87\x0a"))
}
-
-// DXF matches Drawing Exchange Format AutoCAD file.
-// There does not seem to be a clear specification and the files in the wild
-// differ wildly.
-// https://images.autodesk.com/adsk/files/autocad_2012_pdf_dxf-reference_enu.pdf
-//
-// I collected these signatures by downloading a few dozen files from
-// http://cd.textfiles.com/amigaenv/DXF/OBJEKTE/ and
-// https://sembiance.com/fileFormatSamples/poly/dxf/ and then
-// xxd -l 16 {} | sort | uniq.
-// These signatures are only for the ASCII version of DXF. There is a binary version too.
-func DXF(raw []byte, _ uint32) bool {
- return bytes.HasPrefix(raw, []byte(" 0\x0ASECTION\x0A")) ||
- bytes.HasPrefix(raw, []byte(" 0\x0D\x0ASECTION\x0D\x0A")) ||
- bytes.HasPrefix(raw, []byte("0\x0ASECTION\x0A")) ||
- bytes.HasPrefix(raw, []byte("0\x0D\x0ASECTION\x0D\x0A"))
-}
diff --git a/vendor/github.com/gabriel-vasile/mimetype/internal/magic/magic.go b/vendor/github.com/gabriel-vasile/mimetype/internal/magic/magic.go
index 6103c12..5fe435b 100644
--- a/vendor/github.com/gabriel-vasile/mimetype/internal/magic/magic.go
+++ b/vendor/github.com/gabriel-vasile/mimetype/internal/magic/magic.go
@@ -3,6 +3,7 @@ package magic
import (
"bytes"
+ "fmt"
"github.com/gabriel-vasile/mimetype/internal/scan"
)
@@ -21,20 +22,37 @@ type (
}
)
-// offset returns true if the provided signature can be
+// prefix creates a Detector which returns true if any of the provided signatures
+// is the prefix of the raw input.
+func prefix(sigs ...[]byte) Detector {
+ return func(raw []byte, limit uint32) bool {
+ for _, s := range sigs {
+ if bytes.HasPrefix(raw, s) {
+ return true
+ }
+ }
+ return false
+ }
+}
+
+// offset creates a Detector which returns true if the provided signature can be
// found at offset in the raw input.
-func offset(raw []byte, sig []byte, offset int) bool {
- return len(raw) > offset && bytes.HasPrefix(raw[offset:], sig)
+func offset(sig []byte, offset int) Detector {
+ return func(raw []byte, limit uint32) bool {
+ return len(raw) > offset && bytes.HasPrefix(raw[offset:], sig)
+ }
}
// ciPrefix is like prefix but the check is case insensitive.
-func ciPrefix(raw []byte, sigs ...[]byte) bool {
- for _, s := range sigs {
- if ciCheck(s, raw) {
- return true
+func ciPrefix(sigs ...[]byte) Detector {
+ return func(raw []byte, limit uint32) bool {
+ for _, s := range sigs {
+ if ciCheck(s, raw) {
+ return true
+ }
}
+ return false
}
- return false
}
func ciCheck(sig, raw []byte) bool {
if len(raw) < len(sig)+1 {
@@ -54,18 +72,22 @@ func ciCheck(sig, raw []byte) bool {
return true
}
-// xml returns true if any of the provided XML signatures matches the raw input.
-func xml(b scan.Bytes, sigs ...xmlSig) bool {
- b.TrimLWS()
- if len(b) == 0 {
- return false
- }
- for _, s := range sigs {
- if xmlCheck(s, b) {
- return true
+// xml creates a Detector which returns true if any of the provided XML signatures
+// matches the raw input.
+func xml(sigs ...xmlSig) Detector {
+ return func(raw []byte, limit uint32) bool {
+ b := scan.Bytes(raw)
+ b.TrimLWS()
+ if len(b) == 0 {
+ return false
+ }
+ for _, s := range sigs {
+ if xmlCheck(s, b) {
+ return true
+ }
}
+ return false
}
- return false
}
func xmlCheck(sig xmlSig, raw []byte) bool {
raw = raw[:min(len(raw), 512)]
@@ -81,24 +103,28 @@ func xmlCheck(sig xmlSig, raw []byte) bool {
return localNameIndex != -1 && localNameIndex < bytes.Index(raw, sig.xmlns)
}
-// markup returns true is any of the HTML signatures matches the raw input.
-func markup(b scan.Bytes, sigs ...[]byte) bool {
- if bytes.HasPrefix(b, []byte{0xEF, 0xBB, 0xBF}) {
- // We skip the UTF-8 BOM if present to ensure we correctly
- // process any leading whitespace. The presence of the BOM
- // is taken into account during charset detection in charset.go.
- b.Advance(3)
- }
- b.TrimLWS()
- if len(b) == 0 {
- return false
- }
- for _, s := range sigs {
- if markupCheck(s, b) {
- return true
+// markup creates a Detector which returns true is any of the HTML signatures
+// matches the raw input.
+func markup(sigs ...[]byte) Detector {
+ return func(raw []byte, limit uint32) bool {
+ b := scan.Bytes(raw)
+ if bytes.HasPrefix(b, []byte{0xEF, 0xBB, 0xBF}) {
+ // We skip the UTF-8 BOM if present to ensure we correctly
+ // process any leading whitespace. The presence of the BOM
+ // is taken into account during charset detection in charset.go.
+ b.Advance(3)
+ }
+ b.TrimLWS()
+ if len(b) == 0 {
+ return false
}
+ for _, s := range sigs {
+ if markupCheck(s, b) {
+ return true
+ }
+ }
+ return false
}
- return false
}
func markupCheck(sig, raw []byte) bool {
if len(raw) < len(sig)+1 {
@@ -123,17 +149,29 @@ func markupCheck(sig, raw []byte) bool {
return true
}
-// ftyp returns true if any of the FTYP signatures matches the raw input.
-func ftyp(raw []byte, sigs ...[]byte) bool {
- if len(raw) < 12 {
+// ftyp creates a Detector which returns true if any of the FTYP signatures
+// matches the raw input.
+func ftyp(sigs ...[]byte) Detector {
+ return func(raw []byte, limit uint32) bool {
+ if len(raw) < 12 {
+ return false
+ }
+ for _, s := range sigs {
+ if bytes.Equal(raw[8:12], s) {
+ return true
+ }
+ }
return false
}
- for _, s := range sigs {
- if bytes.Equal(raw[8:12], s) {
- return true
- }
+}
+
+func newXMLSig(localName, xmlns string) xmlSig {
+ ret := xmlSig{xmlns: []byte(xmlns)}
+ if localName != "" {
+ ret.localName = []byte(fmt.Sprintf("<%s", localName))
}
- return false
+
+ return ret
}
// A valid shebang starts with the "#!" characters,
@@ -146,17 +184,29 @@ func ftyp(raw []byte, sigs ...[]byte) bool {
// #! /usr/bin/env php
//
// /usr/bin/env is the interpreter, php is the first and only argument.
-func shebang(b scan.Bytes, matchFlags scan.Flags, sigs ...[]byte) bool {
- line := b.Line()
- if len(line) < 2 || line[0] != '#' || line[1] != '!' {
+func shebang(sigs ...[]byte) Detector {
+ return func(raw []byte, limit uint32) bool {
+ b := scan.Bytes(raw)
+ line := b.Line()
+ for _, s := range sigs {
+ if shebangCheck(s, line) {
+ return true
+ }
+ }
return false
}
- line = line[2:]
- line.TrimLWS()
- for _, s := range sigs {
- if line.Match(s, matchFlags) != -1 {
- return true
- }
+}
+
+func shebangCheck(sig []byte, raw scan.Bytes) bool {
+ if len(raw) < len(sig)+2 {
+ return false
+ }
+ if raw[0] != '#' || raw[1] != '!' {
+ return false
}
- return false
+
+ raw.Advance(2) // skip #! we checked above
+ raw.TrimLWS()
+ raw.TrimRWS()
+ return bytes.Equal(raw, sig)
}
diff --git a/vendor/github.com/gabriel-vasile/mimetype/internal/magic/ms_office.go b/vendor/github.com/gabriel-vasile/mimetype/internal/magic/ms_office.go
index bd4a0c3..c912823 100644
--- a/vendor/github.com/gabriel-vasile/mimetype/internal/magic/ms_office.go
+++ b/vendor/github.com/gabriel-vasile/mimetype/internal/magic/ms_office.go
@@ -44,6 +44,17 @@ func Ole(raw []byte, limit uint32) bool {
return bytes.HasPrefix(raw, []byte{0xD0, 0xCF, 0x11, 0xE0, 0xA1, 0xB1, 0x1A, 0xE1})
}
+// Aaf matches an Advanced Authoring Format file.
+// See: https://pyaaf.readthedocs.io/en/latest/about.html
+// See: https://en.wikipedia.org/wiki/Advanced_Authoring_Format
+func Aaf(raw []byte, limit uint32) bool {
+ if len(raw) < 31 {
+ return false
+ }
+ return bytes.HasPrefix(raw[8:], []byte{0x41, 0x41, 0x46, 0x42, 0x0D, 0x00, 0x4F, 0x4D}) &&
+ (raw[30] == 0x09 || raw[30] == 0x0C)
+}
+
// Doc matches a Microsoft Word 97-2003 file.
// See: https://github.com/decalage2/oletools/blob/412ee36ae45e70f42123e835871bac956d958461/oletools/common/clsid.py
func Doc(raw []byte, _ uint32) bool {
@@ -198,14 +209,3 @@ func matchOleClsid(in []byte, clsid []byte) bool {
return bytes.HasPrefix(in[clsidOffset:], clsid)
}
-
-// WPD matches a WordPerfect document.
-func WPD(raw []byte, _ uint32) bool {
- if len(raw) < 10 {
- return false
- }
- if !bytes.HasPrefix(raw, []byte("\xffWPC")) {
- return false
- }
- return raw[8] == 1 && raw[9] == 10
-}
diff --git a/vendor/github.com/gabriel-vasile/mimetype/internal/magic/text.go b/vendor/github.com/gabriel-vasile/mimetype/internal/magic/text.go
index fb84e85..1841ee8 100644
--- a/vendor/github.com/gabriel-vasile/mimetype/internal/magic/text.go
+++ b/vendor/github.com/gabriel-vasile/mimetype/internal/magic/text.go
@@ -10,9 +10,9 @@ import (
"github.com/gabriel-vasile/mimetype/internal/scan"
)
-// HTML matches a Hypertext Markup Language file.
-func HTML(raw []byte, _ uint32) bool {
- return markup(raw,
+var (
+ // HTML matches a Hypertext Markup Language file.
+ HTML = markup(
[]byte("' {
- return nil, nil, false
+ return "", "", false
}
- origS, end := *s, 0
+ // Allocate 10 to avoid resizes.
+ // Attribute names and values are continuous slices of bytes in input,
+ // so we could do without allocating and returning slices of input.
+ nameB := make([]byte, 0, 10)
// step 4 and 5
for {
// bap means byte at position in the specification.
bap := s.Pop()
if bap == 0 {
- return nil, nil, false
+ return "", "", false
}
- if bap == '=' && end > 0 {
+ if bap == '=' && len(nameB) > 0 {
val, hasMore := getAValue(s)
- return origS[:end], val, hasMore
+ return string(nameB), string(val), hasMore
} else if scan.ByteIsWS(bap) {
for scan.ByteIsWS(s.Peek()) {
s.Advance(1)
}
if s.Peek() != '=' {
- return origS[:end], nil, true
+ return string(nameB), "", true
}
s.Advance(1)
for scan.ByteIsWS(s.Peek()) {
s.Advance(1)
}
val, hasMore := getAValue(s)
- return origS[:end], val, hasMore
+ return string(nameB), string(val), hasMore
} else if bap == '/' || bap == '>' {
- return origS[:end], nil, false
- } else { // for any ASCII, non-ASCII, just advance
- end++
+ return string(nameB), "", false
+ } else if bap >= 'A' && bap <= 'Z' {
+ nameB = append(nameB, bap+0x20)
+ } else {
+ nameB = append(nameB, bap)
}
}
}
diff --git a/vendor/github.com/gabriel-vasile/mimetype/internal/scan/bytes.go b/vendor/github.com/gabriel-vasile/mimetype/internal/scan/bytes.go
index b19a949..9f09f07 100644
--- a/vendor/github.com/gabriel-vasile/mimetype/internal/scan/bytes.go
+++ b/vendor/github.com/gabriel-vasile/mimetype/internal/scan/bytes.go
@@ -138,85 +138,46 @@ func (b *Bytes) Uint16() (uint16, bool) {
return v, true
}
-type Flags int
-
const (
- // CompactWS will make one whitespace from pattern to match one or more spaces from input.
- CompactWS Flags = 1 << iota
- // IgnoreCase will match lower case from pattern with lower case from input.
- // IgnoreCase will match upper case from pattern with both lower and upper case from input.
- // This flag is not really well named,
+ CompactWS = 1 << iota
IgnoreCase
- // FullWord ensures the input ends with a full word (it's followed by spaces.)
- FullWord
)
// Search for occurences of pattern p inside b at any index.
-// It returns the index where p was found in b and how many bytes were needed
-// for matching the pattern.
-func (b Bytes) Search(p []byte, flags Flags) (i int, l int) {
- lb, lp := len(b), len(p)
- if lp == 0 {
- return 0, 0
- }
- if lb == 0 {
- return -1, 0
- }
+func (b Bytes) Search(p []byte, flags int) int {
if flags == 0 {
- if i = bytes.Index(b, p); i == -1 {
- return -1, 0
- } else {
- return i, lp
- }
+ return bytes.Index(b, p)
}
+ lb, lp := len(b), len(p)
for i := range b {
if lb-i < lp {
- return -1, 0
+ return -1
}
- if l = b[i:].Match(p, flags); l != -1 {
- return i, l
+ if b[i:].Match(p, flags) {
+ return i
}
}
- return -1, 0
+ return 0
}
-// Match returns how many bytes were needed to match pattern p.
-// It returns -1 if p does not match b.
-func (b Bytes) Match(p []byte, flags Flags) int {
- l := len(b)
- if len(p) == 0 {
- return 0
- }
- if l == 0 {
- return -1
- }
- // If no flags, or scanning for full word at the end of pattern then
- // do a fast HasPrefix check.
- // For other flags it's not possible to use HasPrefix.
- if flags == 0 || flags&FullWord > 0 {
- if bytes.HasPrefix(b, p) {
- b = b[len(p):]
- p = p[len(p):]
- goto out
- }
- return -1
- }
+// Match pattern p at index 0 of b.
+func (b Bytes) Match(p []byte, flags int) bool {
for len(b) > 0 {
- // If we finished all we were looking for from p.
+ // If we finished all we we're looking for from p.
if len(p) == 0 {
- goto out
+ return true
}
if flags&IgnoreCase > 0 && isUpper(p[0]) {
if upper(b[0]) != p[0] {
- return -1
+ return false
}
b, p = b[1:], p[1:]
} else if flags&CompactWS > 0 && ByteIsWS(p[0]) {
p = p[1:]
if !ByteIsWS(b[0]) {
- return -1
+ return false
}
b = b[1:]
if !ByteIsWS(p[0]) {
@@ -224,22 +185,12 @@ func (b Bytes) Match(p []byte, flags Flags) int {
}
} else {
if b[0] != p[0] {
- return -1
+ return false
}
b, p = b[1:], p[1:]
}
}
-out:
- // If p still has leftover characters, it means it didn't fully match b.
- if len(p) > 0 {
- return -1
- }
- if flags&FullWord > 0 {
- if len(b) > 0 && !ByteIsWS(b[0]) {
- return -1
- }
- }
- return l - len(b)
+ return true
}
func isUpper(c byte) bool {
diff --git a/vendor/github.com/gabriel-vasile/mimetype/mime.go b/vendor/github.com/gabriel-vasile/mimetype/mime.go
index ec2bc5b..b82627a 100644
--- a/vendor/github.com/gabriel-vasile/mimetype/mime.go
+++ b/vendor/github.com/gabriel-vasile/mimetype/mime.go
@@ -2,7 +2,6 @@ package mimetype
import (
"mime"
- "strings"
"github.com/gabriel-vasile/mimetype/internal/charset"
"github.com/gabriel-vasile/mimetype/internal/magic"
@@ -110,7 +109,7 @@ func (m *MIME) match(in []byte, readLimit uint32) *MIME {
// Limit the number of bytes searched for to 1024.
charset = f(in[:min(len(in), 1024)])
}
- if m == root || charset == "" {
+ if m == root {
return m
}
@@ -127,27 +126,6 @@ func (m *MIME) flatten() []*MIME {
return out
}
-// hierarchy returns an easy to read list of ancestors for m.
-// For example, application/json would return json>txt>root.
-func (m *MIME) hierarchy() string {
- h := ""
- for m := m; m != nil; m = m.Parent() {
- e := strings.TrimPrefix(m.Extension(), ".")
- if e == "" {
- // There are some MIME without extensions. When generating the hierarchy,
- // it would be confusing to use empty string as extension.
- // Use the subtype instead; ex: application/x-executable -> x-executable.
- e = strings.Split(m.String(), "/")[1]
- if m.Is("application/octet-stream") {
- // for octet-stream use root, because it's short and used in many places
- e = "root"
- }
- }
- h += ">" + e
- }
- return strings.TrimPrefix(h, ">")
-}
-
// clone creates a new MIME with the provided optional MIME parameters.
func (m *MIME) clone(charset string) *MIME {
clonedMIME := m.mime
@@ -177,10 +155,7 @@ func (m *MIME) cloneHierarchy(charset string) *MIME {
}
func (m *MIME) lookup(mime string) *MIME {
- if mime == m.mime {
- return m
- }
- for _, n := range m.aliases {
+ for _, n := range append(m.aliases, m.mime) {
if n == mime {
return m
}
diff --git a/vendor/github.com/gabriel-vasile/mimetype/mimetype.go b/vendor/github.com/gabriel-vasile/mimetype/mimetype.go
index 7927417..d8d512b 100644
--- a/vendor/github.com/gabriel-vasile/mimetype/mimetype.go
+++ b/vendor/github.com/gabriel-vasile/mimetype/mimetype.go
@@ -12,7 +12,7 @@ import (
"sync/atomic"
)
-const defaultLimit uint32 = 3072
+var defaultLimit uint32 = 3072
// readLimit is the maximum number of bytes from the input used when detecting.
var readLimit uint32 = defaultLimit
@@ -112,18 +112,15 @@ func SetLimit(limit uint32) {
}
// Extend adds detection for other file formats.
-// It is equivalent to calling Extend() on the root MIME type "application/octet-stream".
+// It is equivalent to calling Extend() on the root mime type "application/octet-stream".
func Extend(detector func(raw []byte, limit uint32) bool, mime, extension string, aliases ...string) {
root.Extend(detector, mime, extension, aliases...)
}
// Lookup finds a MIME object by its string representation.
-// The representation can be the main MIME type, or any of its aliases.
-func Lookup(m string) *MIME {
- // We store the MIME types without optional params, so
- // perform parsing to extract the target MIME type without optional params.
- m, _, _ = mime.ParseMediaType(m)
+// The representation can be the main mime type, or any of its aliases.
+func Lookup(mime string) *MIME {
mu.RLock()
defer mu.RUnlock()
- return root.lookup(m)
+ return root.lookup(mime)
}
diff --git a/vendor/github.com/gabriel-vasile/mimetype/supported_mimes.md b/vendor/github.com/gabriel-vasile/mimetype/supported_mimes.md
index 241a81f..3186a8b 100644
--- a/vendor/github.com/gabriel-vasile/mimetype/supported_mimes.md
+++ b/vendor/github.com/gabriel-vasile/mimetype/supported_mimes.md
@@ -1,197 +1,196 @@
-## 192 Supported MIME types
+## 191 Supported MIME types
This file is automatically generated when running tests. Do not edit manually.
-Extension | MIME type
Aliases | Hierarchy
---------- | ---------------------- | ---------
-**n/a** | **application/octet-stream** | root
-**.xpm** | **image/x-xpixmap** | xpm>root
-**.7z** | **application/x-7z-compressed** | 7z>root
-**.zip** | **application/zip**
application/x-zip, application/x-zip-compressed | zip>root
-**.docx** | **application/vnd.openxmlformats-officedocument.wordprocessingml.document** | docx>zip>root
-**.pptx** | **application/vnd.openxmlformats-officedocument.presentationml.presentation** | pptx>zip>root
-**.xlsx** | **application/vnd.openxmlformats-officedocument.spreadsheetml.sheet** | xlsx>zip>root
-**.epub** | **application/epub+zip** | epub>zip>root
-**.apk** | **application/vnd.android.package-archive** | apk>zip>root
-**.jar** | **application/java-archive**
application/jar, application/jar-archive, application/x-java-archive | jar>zip>root
-**.odt** | **application/vnd.oasis.opendocument.text**
application/x-vnd.oasis.opendocument.text | odt>zip>root
-**.ott** | **application/vnd.oasis.opendocument.text-template**
application/x-vnd.oasis.opendocument.text-template | ott>odt>zip>root
-**.ods** | **application/vnd.oasis.opendocument.spreadsheet**
application/x-vnd.oasis.opendocument.spreadsheet | ods>zip>root
-**.ots** | **application/vnd.oasis.opendocument.spreadsheet-template**
application/x-vnd.oasis.opendocument.spreadsheet-template | ots>ods>zip>root
-**.odp** | **application/vnd.oasis.opendocument.presentation**
application/x-vnd.oasis.opendocument.presentation | odp>zip>root
-**.otp** | **application/vnd.oasis.opendocument.presentation-template**
application/x-vnd.oasis.opendocument.presentation-template | otp>odp>zip>root
-**.odg** | **application/vnd.oasis.opendocument.graphics**
application/x-vnd.oasis.opendocument.graphics | odg>zip>root
-**.otg** | **application/vnd.oasis.opendocument.graphics-template**
application/x-vnd.oasis.opendocument.graphics-template | otg>odg>zip>root
-**.odf** | **application/vnd.oasis.opendocument.formula**
application/x-vnd.oasis.opendocument.formula | odf>zip>root
-**.odc** | **application/vnd.oasis.opendocument.chart**
application/x-vnd.oasis.opendocument.chart | odc>zip>root
-**.sxc** | **application/vnd.sun.xml.calc** | sxc>zip>root
-**.kmz** | **application/vnd.google-earth.kmz** | kmz>zip>root
-**.vsdx** | **application/vnd.ms-visio.drawing.main+xml** | vsdx>zip>root
-**.pdf** | **application/pdf**
application/x-pdf | pdf>root
-**.fdf** | **application/vnd.fdf** | fdf>root
-**n/a** | **application/x-ole-storage** | x-ole-storage>root
-**.msi** | **application/x-ms-installer**
application/x-windows-installer, application/x-msi | msi>x-ole-storage>root
-**.msg** | **application/vnd.ms-outlook** | msg>x-ole-storage>root
-**.xls** | **application/vnd.ms-excel**
application/msexcel | xls>x-ole-storage>root
-**.pub** | **application/vnd.ms-publisher** | pub>x-ole-storage>root
-**.ppt** | **application/vnd.ms-powerpoint**
application/mspowerpoint | ppt>x-ole-storage>root
-**.doc** | **application/msword**
application/vnd.ms-word | doc>x-ole-storage>root
-**.ps** | **application/postscript** | ps>root
-**.psd** | **image/vnd.adobe.photoshop**
image/x-psd, application/photoshop | psd>root
-**.p7s** | **application/pkcs7-signature** | p7s>root
-**.ogg** | **application/ogg**
application/x-ogg | ogg>root
-**.oga** | **audio/ogg** | oga>ogg>root
-**.ogv** | **video/ogg** | ogv>ogg>root
-**.png** | **image/png** | png>root
-**.png** | **image/vnd.mozilla.apng** | png>png>root
-**.jpg** | **image/jpeg** | jpg>root
-**.jxl** | **image/jxl** | jxl>root
-**.jp2** | **image/jp2** | jp2>root
-**.jpf** | **image/jpx** | jpf>root
-**.jpm** | **image/jpm**
video/jpm | jpm>root
-**.jxs** | **image/jxs** | jxs>root
-**.gif** | **image/gif** | gif>root
-**.webp** | **image/webp** | webp>root
-**.exe** | **application/vnd.microsoft.portable-executable** | exe>root
-**n/a** | **application/x-elf** | x-elf>root
-**n/a** | **application/x-object** | x-object>x-elf>root
-**n/a** | **application/x-executable** | x-executable>x-elf>root
-**.so** | **application/x-sharedlib** | so>x-elf>root
-**n/a** | **application/x-coredump** | x-coredump>x-elf>root
-**.a** | **application/x-archive**
application/x-unix-archive | a>root
-**.deb** | **application/vnd.debian.binary-package** | deb>a>root
-**.tar** | **application/x-tar** | tar>root
-**.xar** | **application/x-xar** | xar>root
-**.bz2** | **application/x-bzip2** | bz2>root
-**.fits** | **application/fits**
image/fits | fits>root
-**.tiff** | **image/tiff** | tiff>root
-**.bmp** | **image/bmp**
image/x-bmp, image/x-ms-bmp | bmp>root
-**.123** | **application/vnd.lotus-1-2-3** | 123>root
-**.ico** | **image/x-icon** | ico>root
-**.mp3** | **audio/mpeg**
audio/x-mpeg, audio/mp3 | mp3>root
-**.flac** | **audio/flac** | flac>root
-**.midi** | **audio/midi**
audio/mid, audio/sp-midi, audio/x-mid, audio/x-midi | midi>root
-**.ape** | **audio/ape** | ape>root
-**.mpc** | **audio/musepack** | mpc>root
-**.amr** | **audio/amr**
audio/amr-nb | amr>root
-**.wav** | **audio/wav**
audio/x-wav, audio/vnd.wave, audio/wave | wav>root
-**.aiff** | **audio/aiff**
audio/x-aiff | aiff>root
-**.au** | **audio/basic** | au>root
-**.mpeg** | **video/mpeg** | mpeg>root
-**.mov** | **video/quicktime** | mov>root
-**.mp4** | **video/mp4** | mp4>root
-**.avif** | **image/avif** | avif>mp4>root
-**.3gp** | **video/3gpp**
video/3gp, audio/3gpp | 3gp>mp4>root
-**.3g2** | **video/3gpp2**
video/3g2, audio/3gpp2 | 3g2>mp4>root
-**.mp4** | **audio/mp4**
audio/x-mp4a | mp4>mp4>root
-**.mqv** | **video/quicktime** | mqv>mp4>root
-**.m4a** | **audio/x-m4a** | m4a>mp4>root
-**.m4v** | **video/x-m4v** | m4v>mp4>root
-**.heic** | **image/heic** | heic>mp4>root
-**.heic** | **image/heic-sequence** | heic>mp4>root
-**.heif** | **image/heif** | heif>mp4>root
-**.heif** | **image/heif-sequence** | heif>mp4>root
-**.mj2** | **video/mj2** | mj2>mp4>root
-**.dvb** | **video/vnd.dvb.file** | dvb>mp4>root
-**.webm** | **video/webm**
audio/webm | webm>root
-**.avi** | **video/x-msvideo**
video/avi, video/msvideo | avi>root
-**.flv** | **video/x-flv** | flv>root
-**.mkv** | **video/x-matroska** | mkv>root
-**.asf** | **video/x-ms-asf**
video/asf, video/x-ms-wmv | asf>root
-**.aac** | **audio/aac** | aac>root
-**.voc** | **audio/x-unknown** | voc>root
-**.m3u** | **application/vnd.apple.mpegurl**
audio/mpegurl | m3u>root
-**.rmvb** | **application/vnd.rn-realmedia-vbr** | rmvb>root
-**.gz** | **application/gzip**
application/x-gzip, application/x-gunzip, application/gzipped, application/gzip-compressed, application/x-gzip-compressed, gzip/document | gz>root
-**.class** | **application/x-java-applet** | class>root
-**.swf** | **application/x-shockwave-flash** | swf>root
-**.crx** | **application/x-chrome-extension** | crx>root
-**.ttf** | **font/ttf**
font/sfnt, application/x-font-ttf, application/font-sfnt | ttf>root
-**.woff** | **font/woff** | woff>root
-**.woff2** | **font/woff2** | woff2>root
-**.otf** | **font/otf** | otf>root
-**.ttc** | **font/collection** | ttc>root
-**.eot** | **application/vnd.ms-fontobject** | eot>root
-**.wasm** | **application/wasm** | wasm>root
-**.shx** | **application/vnd.shx** | shx>root
-**.shp** | **application/vnd.shp** | shp>shx>root
-**.dbf** | **application/x-dbf** | dbf>root
-**.dcm** | **application/dicom** | dcm>root
-**.rar** | **application/x-rar-compressed**
application/x-rar | rar>root
-**.djvu** | **image/vnd.djvu** | djvu>root
-**.mobi** | **application/x-mobipocket-ebook** | mobi>root
-**.lit** | **application/x-ms-reader** | lit>root
-**.bpg** | **image/bpg** | bpg>root
-**.cbor** | **application/cbor** | cbor>root
-**.sqlite** | **application/vnd.sqlite3**
application/x-sqlite3 | sqlite>root
-**.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 | dwg>root
-**.nes** | **application/vnd.nintendo.snes.rom** | nes>root
-**.lnk** | **application/x-ms-shortcut** | lnk>root
-**.macho** | **application/x-mach-binary** | macho>root
-**.qcp** | **audio/qcelp** | qcp>root
-**.icns** | **image/x-icns** | icns>root
-**.hdr** | **image/vnd.radiance** | hdr>root
-**.mrc** | **application/marc** | mrc>root
-**.mdb** | **application/x-msaccess** | mdb>root
-**.accdb** | **application/x-msaccess** | accdb>root
-**.zst** | **application/zstd** | zst>root
-**.cab** | **application/vnd.ms-cab-compressed** | cab>root
-**.rpm** | **application/x-rpm** | rpm>root
-**.xz** | **application/x-xz** | xz>root
-**.lz** | **application/lzip**
application/x-lzip | lz>root
-**.torrent** | **application/x-bittorrent** | torrent>root
-**.cpio** | **application/x-cpio** | cpio>root
-**n/a** | **application/tzif** | tzif>root
-**.xcf** | **image/x-xcf** | xcf>root
-**.pat** | **image/x-gimp-pat** | pat>root
-**.gbr** | **image/x-gimp-gbr** | gbr>root
-**.glb** | **model/gltf-binary** | glb>root
-**.cab** | **application/x-installshield** | cab>root
-**.jxr** | **image/jxr**
image/vnd.ms-photo | jxr>root
-**.parquet** | **application/vnd.apache.parquet**
application/x-parquet | parquet>root
-**.one** | **application/onenote** | one>root
-**.chm** | **application/vnd.ms-htmlhelp** | chm>root
-**.wpd** | **application/vnd.wordperfect** | wpd>root
-**.dxf** | **image/vnd.dxf** | dxf>root
-**.txt** | **text/plain** | txt>root
-**.svg** | **image/svg+xml** | svg>txt>root
-**.html** | **text/html** | html>txt>root
-**.xml** | **text/xml**
application/xml | xml>txt>root
-**.rss** | **application/rss+xml**
text/rss | rss>xml>txt>root
-**.atom** | **application/atom+xml** | atom>xml>txt>root
-**.x3d** | **model/x3d+xml** | x3d>xml>txt>root
-**.kml** | **application/vnd.google-earth.kml+xml** | kml>xml>txt>root
-**.xlf** | **application/x-xliff+xml** | xlf>xml>txt>root
-**.dae** | **model/vnd.collada+xml** | dae>xml>txt>root
-**.gml** | **application/gml+xml** | gml>xml>txt>root
-**.gpx** | **application/gpx+xml** | gpx>xml>txt>root
-**.tcx** | **application/vnd.garmin.tcx+xml** | tcx>xml>txt>root
-**.amf** | **application/x-amf** | amf>xml>txt>root
-**.3mf** | **application/vnd.ms-package.3dmanufacturing-3dmodel+xml** | 3mf>xml>txt>root
-**.xfdf** | **application/vnd.adobe.xfdf** | xfdf>xml>txt>root
-**.owl** | **application/owl+xml** | owl>xml>txt>root
-**.html** | **application/xhtml+xml** | html>xml>txt>root
-**.php** | **text/x-php** | php>txt>root
-**.js** | **text/javascript**
application/x-javascript, application/javascript | js>txt>root
-**.lua** | **text/x-lua** | lua>txt>root
-**.pl** | **text/x-perl** | pl>txt>root
-**.py** | **text/x-python**
text/x-script.python, application/x-python | py>txt>root
-**.rb** | **text/x-ruby**
application/x-ruby | rb>txt>root
-**.json** | **application/json** | json>txt>root
-**.geojson** | **application/geo+json** | geojson>json>txt>root
-**.har** | **application/json** | har>json>txt>root
-**.gltf** | **model/gltf+json** | gltf>json>txt>root
-**.ndjson** | **application/x-ndjson** | ndjson>txt>root
-**.rtf** | **text/rtf**
application/rtf | rtf>txt>root
-**.srt** | **application/x-subrip**
application/x-srt, text/x-srt | srt>txt>root
-**.tcl** | **text/x-tcl**
application/x-tcl | tcl>txt>root
-**.csv** | **text/csv** | csv>txt>root
-**.tsv** | **text/tab-separated-values** | tsv>txt>root
-**.vcf** | **text/vcard** | vcf>txt>root
-**.ics** | **text/calendar** | ics>txt>root
-**.warc** | **application/warc** | warc>txt>root
-**.vtt** | **text/vtt** | vtt>txt>root
-**.sh** | **text/x-shellscript**
text/x-sh, application/x-shellscript, application/x-sh | sh>txt>root
-**.pbm** | **image/x-portable-bitmap** | pbm>txt>root
-**.pgm** | **image/x-portable-graymap** | pgm>txt>root
-**.ppm** | **image/x-portable-pixmap** | ppm>txt>root
-**.pam** | **image/x-portable-arbitrarymap** | pam>txt>root
+Extension | MIME type | Aliases
+--------- | --------- | -------
+**n/a** | application/octet-stream | -
+**.xpm** | image/x-xpixmap | -
+**.7z** | application/x-7z-compressed | -
+**.zip** | application/zip | application/x-zip, application/x-zip-compressed
+**.docx** | application/vnd.openxmlformats-officedocument.wordprocessingml.document | -
+**.pptx** | application/vnd.openxmlformats-officedocument.presentationml.presentation | -
+**.xlsx** | application/vnd.openxmlformats-officedocument.spreadsheetml.sheet | -
+**.epub** | application/epub+zip | -
+**.apk** | application/vnd.android.package-archive | -
+**.jar** | application/java-archive | application/jar, application/jar-archive, application/x-java-archive
+**.odt** | application/vnd.oasis.opendocument.text | application/x-vnd.oasis.opendocument.text
+**.ott** | application/vnd.oasis.opendocument.text-template | application/x-vnd.oasis.opendocument.text-template
+**.ods** | application/vnd.oasis.opendocument.spreadsheet | application/x-vnd.oasis.opendocument.spreadsheet
+**.ots** | application/vnd.oasis.opendocument.spreadsheet-template | application/x-vnd.oasis.opendocument.spreadsheet-template
+**.odp** | application/vnd.oasis.opendocument.presentation | application/x-vnd.oasis.opendocument.presentation
+**.otp** | application/vnd.oasis.opendocument.presentation-template | application/x-vnd.oasis.opendocument.presentation-template
+**.odg** | application/vnd.oasis.opendocument.graphics | application/x-vnd.oasis.opendocument.graphics
+**.otg** | application/vnd.oasis.opendocument.graphics-template | application/x-vnd.oasis.opendocument.graphics-template
+**.odf** | application/vnd.oasis.opendocument.formula | application/x-vnd.oasis.opendocument.formula
+**.odc** | application/vnd.oasis.opendocument.chart | application/x-vnd.oasis.opendocument.chart
+**.sxc** | application/vnd.sun.xml.calc | -
+**.kmz** | application/vnd.google-earth.kmz | -
+**.vsdx** | application/vnd.ms-visio.drawing.main+xml | -
+**.pdf** | application/pdf | application/x-pdf
+**.fdf** | application/vnd.fdf | -
+**n/a** | application/x-ole-storage | -
+**.msi** | application/x-ms-installer | application/x-windows-installer, application/x-msi
+**.aaf** | application/octet-stream | -
+**.msg** | application/vnd.ms-outlook | -
+**.xls** | application/vnd.ms-excel | application/msexcel
+**.pub** | application/vnd.ms-publisher | -
+**.ppt** | application/vnd.ms-powerpoint | application/mspowerpoint
+**.doc** | application/msword | application/vnd.ms-word
+**.ps** | application/postscript | -
+**.psd** | image/vnd.adobe.photoshop | image/x-psd, application/photoshop
+**.p7s** | application/pkcs7-signature | -
+**.ogg** | application/ogg | application/x-ogg
+**.oga** | audio/ogg | -
+**.ogv** | video/ogg | -
+**.png** | image/png | -
+**.png** | image/vnd.mozilla.apng | -
+**.jpg** | image/jpeg | -
+**.jxl** | image/jxl | -
+**.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 | -
+**n/a** | application/x-elf | -
+**n/a** | application/x-object | -
+**n/a** | application/x-executable | -
+**.so** | application/x-sharedlib | -
+**n/a** | application/x-coredump | -
+**.a** | application/x-archive | application/x-unix-archive
+**.deb** | application/vnd.debian.binary-package | -
+**.tar** | application/x-tar | -
+**.xar** | application/x-xar | -
+**.bz2** | application/x-bzip2 | -
+**.fits** | application/fits | image/fits
+**.tiff** | image/tiff | -
+**.bmp** | image/bmp | image/x-bmp, image/x-ms-bmp
+**.123** | application/vnd.lotus-1-2-3 | -
+**.ico** | image/x-icon | -
+**.mp3** | audio/mpeg | audio/x-mpeg, audio/mp3
+**.flac** | audio/flac | -
+**.midi** | audio/midi | audio/mid, audio/sp-midi, audio/x-mid, audio/x-midi
+**.ape** | audio/ape | -
+**.mpc** | audio/musepack | -
+**.amr** | audio/amr | audio/amr-nb
+**.wav** | audio/wav | audio/x-wav, audio/vnd.wave, audio/wave
+**.aiff** | audio/aiff | audio/x-aiff
+**.au** | audio/basic | -
+**.mpeg** | video/mpeg | -
+**.mov** | video/quicktime | -
+**.mp4** | video/mp4 | -
+**.avif** | image/avif | -
+**.3gp** | video/3gpp | video/3gp, audio/3gpp
+**.3g2** | video/3gpp2 | video/3g2, audio/3gpp2
+**.mp4** | audio/mp4 | audio/x-mp4a
+**.mqv** | video/quicktime | -
+**.m4a** | audio/x-m4a | -
+**.m4v** | video/x-m4v | -
+**.heic** | image/heic | -
+**.heic** | image/heic-sequence | -
+**.heif** | image/heif | -
+**.heif** | image/heif-sequence | -
+**.mj2** | video/mj2 | -
+**.dvb** | video/vnd.dvb.file | -
+**.webm** | video/webm | audio/webm
+**.avi** | video/x-msvideo | video/avi, video/msvideo
+**.flv** | video/x-flv | -
+**.mkv** | video/x-matroska | -
+**.asf** | video/x-ms-asf | video/asf, video/x-ms-wmv
+**.aac** | audio/aac | -
+**.voc** | audio/x-unknown | -
+**.m3u** | application/vnd.apple.mpegurl | audio/mpegurl
+**.rmvb** | application/vnd.rn-realmedia-vbr | -
+**.gz** | application/gzip | application/x-gzip, application/x-gunzip, application/gzipped, application/gzip-compressed, application/x-gzip-compressed, gzip/document
+**.class** | application/x-java-applet | -
+**.swf** | application/x-shockwave-flash | -
+**.crx** | application/x-chrome-extension | -
+**.ttf** | font/ttf | font/sfnt, application/x-font-ttf, application/font-sfnt
+**.woff** | font/woff | -
+**.woff2** | font/woff2 | -
+**.otf** | font/otf | -
+**.ttc** | font/collection | -
+**.eot** | application/vnd.ms-fontobject | -
+**.wasm** | application/wasm | -
+**.shx** | application/vnd.shx | -
+**.shp** | application/vnd.shp | -
+**.dbf** | application/x-dbf | -
+**.dcm** | application/dicom | -
+**.rar** | application/x-rar-compressed | application/x-rar
+**.djvu** | image/vnd.djvu | -
+**.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 | -
+**.lnk** | application/x-ms-shortcut | -
+**.macho** | application/x-mach-binary | -
+**.qcp** | audio/qcelp | -
+**.icns** | image/x-icns | -
+**.hdr** | image/vnd.radiance | -
+**.mrc** | application/marc | -
+**.mdb** | application/x-msaccess | -
+**.accdb** | application/x-msaccess | -
+**.zst** | application/zstd | -
+**.cab** | application/vnd.ms-cab-compressed | -
+**.rpm** | application/x-rpm | -
+**.xz** | application/x-xz | -
+**.lz** | application/lzip | application/x-lzip
+**.torrent** | application/x-bittorrent | -
+**.cpio** | application/x-cpio | -
+**n/a** | application/tzif | -
+**.xcf** | image/x-xcf | -
+**.pat** | image/x-gimp-pat | -
+**.gbr** | image/x-gimp-gbr | -
+**.glb** | model/gltf-binary | -
+**.cab** | application/x-installshield | -
+**.jxr** | image/jxr | image/vnd.ms-photo
+**.parquet** | application/vnd.apache.parquet | application/x-parquet
+**.one** | application/onenote | -
+**.chm** | application/vnd.ms-htmlhelp | -
+**.txt** | text/plain | -
+**.svg** | image/svg+xml | -
+**.html** | text/html | -
+**.xml** | text/xml | application/xml
+**.rss** | application/rss+xml | text/rss
+**.atom** | application/atom+xml | -
+**.x3d** | model/x3d+xml | -
+**.kml** | application/vnd.google-earth.kml+xml | -
+**.xlf** | application/x-xliff+xml | -
+**.dae** | model/vnd.collada+xml | -
+**.gml** | application/gml+xml | -
+**.gpx** | application/gpx+xml | -
+**.tcx** | application/vnd.garmin.tcx+xml | -
+**.amf** | application/x-amf | -
+**.3mf** | application/vnd.ms-package.3dmanufacturing-3dmodel+xml | -
+**.xfdf** | application/vnd.adobe.xfdf | -
+**.owl** | application/owl+xml | -
+**.html** | application/xhtml+xml | -
+**.php** | text/x-php | -
+**.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
+**.rb** | text/x-ruby | application/x-ruby
+**.json** | application/json | -
+**.geojson** | application/geo+json | -
+**.har** | application/json | -
+**.gltf** | model/gltf+json | -
+**.ndjson** | application/x-ndjson | -
+**.rtf** | text/rtf | application/rtf
+**.srt** | application/x-subrip | application/x-srt, text/x-srt
+**.tcl** | text/x-tcl | application/x-tcl
+**.csv** | text/csv | -
+**.tsv** | text/tab-separated-values | -
+**.vcf** | text/vcard | -
+**.ics** | text/calendar | -
+**.warc** | application/warc | -
+**.vtt** | text/vtt | -
+**.sh** | text/x-shellscript | text/x-sh, application/x-shellscript, application/x-sh
+**.pbm** | image/x-portable-bitmap | -
+**.pgm** | image/x-portable-graymap | -
+**.ppm** | image/x-portable-pixmap | -
+**.pam** | image/x-portable-arbitrarymap | -
diff --git a/vendor/github.com/gabriel-vasile/mimetype/tree.go b/vendor/github.com/gabriel-vasile/mimetype/tree.go
index 21b70d5..edbde89 100644
--- a/vendor/github.com/gabriel-vasile/mimetype/tree.go
+++ b/vendor/github.com/gabriel-vasile/mimetype/tree.go
@@ -24,7 +24,7 @@ var root = newMIME("application/octet-stream", "",
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,
- oneNote, chm, wpd, dxf,
+ oneNote, chm,
// Keep text last because it is the slowest check.
text,
)
@@ -65,9 +65,10 @@ var (
jar = newMIME("application/java-archive", ".jar", magic.Jar).
alias("application/jar", "application/jar-archive", "application/x-java-archive")
apk = newMIME("application/vnd.android.package-archive", ".apk", magic.APK)
- ole = newMIME("application/x-ole-storage", "", magic.Ole, msi, msg, xls, pub, ppt, doc)
+ ole = newMIME("application/x-ole-storage", "", magic.Ole, msi, aaf, msg, xls, pub, ppt, doc)
msi = newMIME("application/x-ms-installer", ".msi", magic.Msi).
alias("application/x-windows-installer", "application/x-msi")
+ aaf = newMIME("application/octet-stream", ".aaf", magic.Aaf)
doc = newMIME("application/msword", ".doc", magic.Doc).
alias("application/vnd.ms-word")
ppt = newMIME("application/vnd.ms-powerpoint", ".ppt", magic.Ppt).
@@ -285,6 +286,4 @@ var (
cbor = newMIME("application/cbor", ".cbor", magic.CBOR)
oneNote = newMIME("application/onenote", ".one", magic.One)
chm = newMIME("application/vnd.ms-htmlhelp", ".chm", magic.CHM)
- wpd = newMIME("application/vnd.wordperfect", ".wpd", magic.WPD)
- dxf = newMIME("image/vnd.dxf", ".dxf", magic.DXF)
)
diff --git a/vendor/google.golang.org/protobuf/internal/filedesc/desc.go b/vendor/google.golang.org/protobuf/internal/filedesc/desc.go
index dbcf90b..688aabe 100644
--- a/vendor/google.golang.org/protobuf/internal/filedesc/desc.go
+++ b/vendor/google.golang.org/protobuf/internal/filedesc/desc.go
@@ -72,10 +72,9 @@ type (
EditionFeatures EditionFeatures
}
FileL2 struct {
- Options func() protoreflect.ProtoMessage
- Imports FileImports
- OptionImports func() protoreflect.FileImports
- Locations SourceLocations
+ Options func() protoreflect.ProtoMessage
+ Imports FileImports
+ Locations SourceLocations
}
// EditionFeatures is a frequently-instantiated struct, so please take care
@@ -127,9 +126,12 @@ func (fd *File) ParentFile() protoreflect.FileDescriptor { return fd }
func (fd *File) Parent() protoreflect.Descriptor { return nil }
func (fd *File) Index() int { return 0 }
func (fd *File) Syntax() protoreflect.Syntax { return fd.L1.Syntax }
-func (fd *File) Name() protoreflect.Name { return fd.L1.Package.Name() }
-func (fd *File) FullName() protoreflect.FullName { return fd.L1.Package }
-func (fd *File) IsPlaceholder() bool { return false }
+
+// Not exported and just used to reconstruct the original FileDescriptor proto
+func (fd *File) Edition() int32 { return int32(fd.L1.Edition) }
+func (fd *File) Name() protoreflect.Name { return fd.L1.Package.Name() }
+func (fd *File) FullName() protoreflect.FullName { return fd.L1.Package }
+func (fd *File) IsPlaceholder() bool { return false }
func (fd *File) Options() protoreflect.ProtoMessage {
if f := fd.lazyInit().Options; f != nil {
return f()
@@ -148,16 +150,6 @@ func (fd *File) Format(s fmt.State, r rune) { descfmt.FormatD
func (fd *File) ProtoType(protoreflect.FileDescriptor) {}
func (fd *File) ProtoInternal(pragma.DoNotImplement) {}
-// The next two are not part of the FileDescriptor interface. They are just used to reconstruct
-// the original FileDescriptor proto.
-func (fd *File) Edition() int32 { return int32(fd.L1.Edition) }
-func (fd *File) OptionImports() protoreflect.FileImports {
- if f := fd.lazyInit().OptionImports; f != nil {
- return f()
- }
- return emptyFiles
-}
-
func (fd *File) lazyInit() *FileL2 {
if atomic.LoadUint32(&fd.once) == 0 {
fd.lazyInitOnce()
@@ -190,9 +182,9 @@ type (
L2 *EnumL2 // protected by fileDesc.once
}
EnumL1 struct {
+ eagerValues bool // controls whether EnumL2.Values is already populated
+
EditionFeatures EditionFeatures
- Visibility int32
- eagerValues bool // controls whether EnumL2.Values is already populated
}
EnumL2 struct {
Options func() protoreflect.ProtoMessage
@@ -227,11 +219,6 @@ func (ed *Enum) ReservedNames() protoreflect.Names { return &ed.lazyInit()
func (ed *Enum) ReservedRanges() protoreflect.EnumRanges { return &ed.lazyInit().ReservedRanges }
func (ed *Enum) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, ed) }
func (ed *Enum) ProtoType(protoreflect.EnumDescriptor) {}
-
-// This is not part of the EnumDescriptor interface. It is just used to reconstruct
-// the original FileDescriptor proto.
-func (ed *Enum) Visibility() int32 { return ed.L1.Visibility }
-
func (ed *Enum) lazyInit() *EnumL2 {
ed.L0.ParentFile.lazyInit() // implicitly initializes L2
return ed.L2
@@ -257,13 +244,13 @@ type (
L2 *MessageL2 // protected by fileDesc.once
}
MessageL1 struct {
- Enums Enums
- Messages Messages
- Extensions Extensions
+ Enums Enums
+ Messages Messages
+ Extensions Extensions
+ IsMapEntry bool // promoted from google.protobuf.MessageOptions
+ IsMessageSet bool // promoted from google.protobuf.MessageOptions
+
EditionFeatures EditionFeatures
- Visibility int32
- IsMapEntry bool // promoted from google.protobuf.MessageOptions
- IsMessageSet bool // promoted from google.protobuf.MessageOptions
}
MessageL2 struct {
Options func() protoreflect.ProtoMessage
@@ -332,11 +319,6 @@ func (md *Message) Messages() protoreflect.MessageDescriptors { return &md.L
func (md *Message) Extensions() protoreflect.ExtensionDescriptors { return &md.L1.Extensions }
func (md *Message) ProtoType(protoreflect.MessageDescriptor) {}
func (md *Message) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, md) }
-
-// This is not part of the MessageDescriptor interface. It is just used to reconstruct
-// the original FileDescriptor proto.
-func (md *Message) Visibility() int32 { return md.L1.Visibility }
-
func (md *Message) lazyInit() *MessageL2 {
md.L0.ParentFile.lazyInit() // implicitly initializes L2
return md.L2
diff --git a/vendor/google.golang.org/protobuf/internal/filedesc/desc_init.go b/vendor/google.golang.org/protobuf/internal/filedesc/desc_init.go
index e91860f..d2f5494 100644
--- a/vendor/google.golang.org/protobuf/internal/filedesc/desc_init.go
+++ b/vendor/google.golang.org/protobuf/internal/filedesc/desc_init.go
@@ -284,13 +284,6 @@ func (ed *Enum) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd protorefl
case genid.EnumDescriptorProto_Value_field_number:
numValues++
}
- case protowire.VarintType:
- v, m := protowire.ConsumeVarint(b)
- b = b[m:]
- switch num {
- case genid.EnumDescriptorProto_Visibility_field_number:
- ed.L1.Visibility = int32(v)
- }
default:
m := protowire.ConsumeFieldValue(num, typ, b)
b = b[m:]
@@ -372,13 +365,6 @@ func (md *Message) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd protor
md.unmarshalSeedOptions(v)
}
prevField = num
- case protowire.VarintType:
- v, m := protowire.ConsumeVarint(b)
- b = b[m:]
- switch num {
- case genid.DescriptorProto_Visibility_field_number:
- md.L1.Visibility = int32(v)
- }
default:
m := protowire.ConsumeFieldValue(num, typ, b)
b = b[m:]
diff --git a/vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.go b/vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.go
index dd31faa..d4c9445 100644
--- a/vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.go
+++ b/vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.go
@@ -134,7 +134,6 @@ func (fd *File) unmarshalFull(b []byte) {
var enumIdx, messageIdx, extensionIdx, serviceIdx int
var rawOptions []byte
- var optionImports []string
fd.L2 = new(FileL2)
for len(b) > 0 {
num, typ, n := protowire.ConsumeTag(b)
@@ -158,8 +157,6 @@ func (fd *File) unmarshalFull(b []byte) {
imp = PlaceholderFile(path)
}
fd.L2.Imports = append(fd.L2.Imports, protoreflect.FileImport{FileDescriptor: imp})
- case genid.FileDescriptorProto_OptionDependency_field_number:
- optionImports = append(optionImports, sb.MakeString(v))
case genid.FileDescriptorProto_EnumType_field_number:
fd.L1.Enums.List[enumIdx].unmarshalFull(v, sb)
enumIdx++
@@ -181,23 +178,6 @@ func (fd *File) unmarshalFull(b []byte) {
}
}
fd.L2.Options = fd.builder.optionsUnmarshaler(&descopts.File, rawOptions)
- if len(optionImports) > 0 {
- var imps FileImports
- var once sync.Once
- fd.L2.OptionImports = func() protoreflect.FileImports {
- once.Do(func() {
- imps = make(FileImports, len(optionImports))
- for i, path := range optionImports {
- imp, _ := fd.builder.FileRegistry.FindFileByPath(path)
- if imp == nil {
- imp = PlaceholderFile(path)
- }
- imps[i] = protoreflect.FileImport{FileDescriptor: imp}
- }
- })
- return &imps
- }
- }
}
func (ed *Enum) unmarshalFull(b []byte, sb *strs.Builder) {
diff --git a/vendor/google.golang.org/protobuf/internal/version/version.go b/vendor/google.golang.org/protobuf/internal/version/version.go
index 77de0f2..31e79a6 100644
--- a/vendor/google.golang.org/protobuf/internal/version/version.go
+++ b/vendor/google.golang.org/protobuf/internal/version/version.go
@@ -52,7 +52,7 @@ import (
const (
Major = 1
Minor = 36
- Patch = 10
+ Patch = 9
PreRelease = ""
)
diff --git a/vendor/modules.txt b/vendor/modules.txt
index 473c0dc..1e9304d 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -16,7 +16,7 @@ github.com/cespare/xxhash/v2
## explicit
github.com/codemodus/kace
github.com/codemodus/kace/ktrie
-# github.com/gabriel-vasile/mimetype v1.4.11
+# github.com/gabriel-vasile/mimetype v1.4.10
## explicit; go 1.21
github.com/gabriel-vasile/mimetype
github.com/gabriel-vasile/mimetype/internal/charset
@@ -280,7 +280,7 @@ golang.org/x/tools/internal/stdlib
golang.org/x/tools/internal/typeparams
golang.org/x/tools/internal/typesinternal
golang.org/x/tools/internal/versions
-# google.golang.org/protobuf v1.36.10
+# google.golang.org/protobuf v1.36.9
## explicit; go 1.23
google.golang.org/protobuf/encoding/protodelim
google.golang.org/protobuf/encoding/prototext