From 56ce796091a0288ffaf3431c9ca9e42b779b14aa Mon Sep 17 00:00:00 2001 From: Sergey Bykov Date: Fri, 13 Oct 2023 19:28:02 +0300 Subject: [PATCH] Allow any mime types via * --- cmd/vfssrv/main.go | 2 +- vfs.go | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cmd/vfssrv/main.go b/cmd/vfssrv/main.go index a2988a9..5f86003 100644 --- a/cmd/vfssrv/main.go +++ b/cmd/vfssrv/main.go @@ -30,7 +30,7 @@ var ( flWebPath = fs.String("webpath", "/media/", "web path to files") flPreviewPath = fs.String("preview-path", "/media/small/", "preview path to image files") flExtensions = fs.String("ext", "jpg,jpeg,png,gif", "allowed file extensions for hash upload, separated by comma") - flMimeTypes = fs.String("mime", "image/jpeg,image/png,image/gif", "allowed mime types for hash upload, separated by comma") + flMimeTypes = fs.String("mime", "image/jpeg,image/png,image/gif", "allowed mime types for hash upload, separated by comma (use * for any)") flDbConn = fs.String("conn", "postgresql://localhost:5432/vfs?sslmode=disable", "database connection dsn") flJWTKey = fs.String("jwt-key", "QuiuNae9OhzoKohcee0h", "JWT key") flJWTHeader = fs.String("jwt-header", "AuthorizationJWT", "JWT header") diff --git a/vfs.go b/vfs.go index d6a5055..9667878 100644 --- a/vfs.go +++ b/vfs.go @@ -260,6 +260,10 @@ func (v VFS) IsValidMimeType(mType string) bool { } for _, m := range v.cfg.MimeTypes { + if m == "*" { + return true + } + if m == mType { return true }