diff --git a/cmd/files.go b/cmd/files.go index e8ec849..e80aaa1 100644 --- a/cmd/files.go +++ b/cmd/files.go @@ -8,6 +8,7 @@ import ( "errors" "fmt" "math/big" + "regexp" "crypto/rand" "os" @@ -30,6 +31,11 @@ const ( maxFileScans maxConcurrency = 256 ) +type Regexes struct { + alphanumeric *regexp.Regexp + filename *regexp.Regexp +} + type Concurrency struct { directoryScans chan int fileScans chan int diff --git a/cmd/root.go b/cmd/root.go index f80c217..6283f5e 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -12,7 +12,7 @@ import ( ) const ( - Version string = "0.69.2" + Version string = "0.69.3" ) var ( diff --git a/cmd/web.go b/cmd/web.go index cfb9e22..f1245a1 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -37,11 +37,6 @@ const ( Timeout time.Duration = 10 * time.Second ) -type Regexes struct { - alphanumeric *regexp.Regexp - filename *regexp.Regexp -} - func serveStaticFile(paths []string, stats *ServeStats, index *Index) httprouter.Handle { return func(w http.ResponseWriter, r *http.Request, p httprouter.Params) { path := strings.TrimPrefix(r.URL.Path, SourcePrefix) diff --git a/formats/audio.go b/formats/audio.go index db4acc4..a5fbdf1 100644 --- a/formats/audio.go +++ b/formats/audio.go @@ -15,7 +15,7 @@ func RegisterAudioFormats() *SupportedFormat { return fmt.Sprintf(`%s`, fileName) }, Body: func(queryParams, fileUri, filePath, fileName, mime string) string { - return fmt.Sprintf(``, + return fmt.Sprintf(``, queryParams, fileUri, mime, diff --git a/formats/images.go b/formats/images.go index 5ca3e3a..767a8af 100644 --- a/formats/images.go +++ b/formats/images.go @@ -51,18 +51,27 @@ func RegisterImageFormats() *SupportedFormat { fileName) }, Extensions: []string{ + `.apng`, + `.avif`, `.bmp`, `.gif`, `.jpg`, `.jpeg`, + `.jfif`, + `.pjp`, + `.pjpeg`, `.png`, + `.svg`, `.webp`, }, MimeTypes: []string{ + `image/apng`, + `image/avif`, `image/bmp`, `image/gif`, `image/jpeg`, `image/png`, + `image/svg+xml`, `image/webp`, }, Validate: func(filePath string) bool { diff --git a/formats/video.go b/formats/video.go index e6f18e9..b199b30 100644 --- a/formats/video.go +++ b/formats/video.go @@ -15,7 +15,7 @@ func RegisterVideoFormats() *SupportedFormat { return fmt.Sprintf(`%s`, fileName) }, Body: func(queryParams, fileUri, filePath, fileName, mime string) string { - return fmt.Sprintf(``, + return fmt.Sprintf(``, queryParams, fileUri, mime,