From 66767ded4f006ba7b4dde16fdaf204332b1d4490 Mon Sep 17 00:00:00 2001 From: clsr Date: Fri, 17 Jun 2016 17:54:56 +0200 Subject: Rename --forbid-* to --filter-* --- USAGE | 8 ++++---- main.go | 8 ++++---- storage.go | 10 +++++----- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/USAGE b/USAGE index ff0b4e3..b19f508 100644 --- a/USAGE +++ b/USAGE @@ -68,13 +68,13 @@ Running example (10 MiB): --bytes 10485760 equivalent bash example: --bytes $((1024 * 1024 * 10)) - --forbid-ext EXTS + --filter-ext EXTS forbids file extensions contained in the comma-separated list EXTS - example: --forbid-ext exe,dll,scr + example: --filter-ext exe,dll,scr - --forbid-mime TYPES + --filter-mime TYPES forbids MIME types contained in the comma-separated list TYPES - example: --forbid-mime application/x-dosexec + example: --filters-mime application/x-dosexec --contact EMAIL sets the contact email address to EMAIL diff --git a/main.go b/main.go index c938501..ae2c9f5 100644 --- a/main.go +++ b/main.go @@ -68,8 +68,8 @@ func main() { cert := flag.String("cert", "", "path to TLS certificate (for HTTPS)") key := flag.String("key", "", "path to TLS key (for HTTPS)") maxSize := flag.Int64("max-size", 50*1024*1024, "max filesize in bytes") - forbidMime := flag.String("forbid-mime", "application/x-dosexec,application/x-msdos-program", "comma-separated list of forbidden MIME types") - forbidExt := flag.String("forbid-ext", "exe,dll,msi,scr,com,pif", "comma-separated list of forbidden file extensions") + filterMime := flag.String("filter-mime", "application/x-dosexec,application/x-msdos-program", "comma-separated list of filtered MIME types") + filterExt := flag.String("filter-ext", "exe,dll,msi,scr,com,pif", "comma-separated list of filtered file extensions") grill := flag.Bool("grill", false, "enable grills") idLength := flag.Int("id-length", 6, "length of uploaded file IDs") idCharset := flag.String("id-charset", "", "charset for uploaded file IDs (default lowercase letters a-z)") @@ -81,8 +81,8 @@ func main() { initWebsite() storage = NewStorage("upload", *maxSize) - storage.ForbiddenExt = strings.Split(*forbidExt, ",") - storage.ForbiddenMime = strings.Split(*forbidMime, ",") + storage.FilterExt = strings.Split(*filterExt, ",") + storage.FilterMime = strings.Split(*filterMime, ",") storage.IdLength = *idLength if *idCharset != "" { storage.IdCharset = *idCharset diff --git a/storage.go b/storage.go index 95ad72b..1954c1a 100644 --- a/storage.go +++ b/storage.go @@ -30,8 +30,8 @@ type Storage struct { IdCharset string IdLength int MaxSize int64 - ForbiddenMime []string - ForbiddenExt []string + FilterMime []string + FilterExt []string } type ErrForbidden struct{ Type string } @@ -201,17 +201,17 @@ func (s *Storage) getMimeExt(fpath string, name string) (mimetype, ext string, e } } - // reject forbidden MIME types and file extensions + // reject filtered MIME types and file extensions if mimetype != "application/octet-stream" { for _, e := range exts { - for _, fe := range s.ForbiddenExt { + for _, fe := range s.FilterExt { if e == fe { err = ErrForbidden{fe} return } } } - for _, fm := range s.ForbiddenMime { + for _, fm := range s.FilterMime { if mimetype == fm { err = ErrForbidden{fm} return -- cgit