diff options
author | clsr <clsr@clsr.net> | 2016-08-02 13:16:45 +0200 |
---|---|---|
committer | clsr <clsr@clsr.net> | 2016-08-02 13:16:45 +0200 |
commit | 35b0c989f7a33b09a33abf9c7c8f65d08ebdfaa6 (patch) | |
tree | 7e8a1a47673d21f072854750ad9cceb0b7d8ce6a | |
parent | 9f3d137026822bc5891cf6575a321ccd9558d448 (diff) | |
download | gomf-35b0c989f7a33b09a33abf9c7c8f65d08ebdfaa6.tar.gz gomf-35b0c989f7a33b09a33abf9c7c8f65d08ebdfaa6.zip |
Remove maxSize argument from NewStorage
-rw-r--r-- | main.go | 7 | ||||
-rw-r--r-- | storage.go | 4 |
2 files changed, 6 insertions, 5 deletions
@@ -69,12 +69,12 @@ func main() { listenHttps := flag.String("https", "", "address to listen on for HTTPS") 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") + maxSize := flag.Int64("max-size", DefaultMaxSize, "max filesize in bytes") 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") whitelist := flag.Bool("whitelist", false, "use filter as a whitelist instead of blacklist") grill := flag.Bool("grill", false, "enable grills") - idLength := flag.Int("id-length", 6, "length of uploaded file IDs") + idLength := flag.Int("id-length", DefaultIdLength, "length of uploaded file IDs") idCharset := flag.String("id-charset", "", "charset for uploaded file IDs (default lowercase letters a-z)") flag.Parse() @@ -83,11 +83,12 @@ func main() { initWebsite() - storage = NewStorage("upload", *maxSize) + storage = NewStorage("upload") storage.FilterExt = strings.Split(*filterExt, ",") storage.FilterMime = strings.Split(*filterMime, ",") storage.Whitelist = *whitelist storage.IdLength = *idLength + storage.MaxSize = *maxSize if *idCharset != "" { storage.IdCharset = *idCharset } @@ -49,7 +49,7 @@ type ErrNotFound struct{ Name string } func (e ErrNotFound) Error() string { return "file " + e.Name + " not found" } -func NewStorage(folder string, maxSize int64) *Storage { +func NewStorage(folder string) *Storage { if err := os.MkdirAll(path.Join(folder, "temp"), 0755); err != nil { panic(err) } @@ -64,7 +64,7 @@ func NewStorage(folder string, maxSize int64) *Storage { Folder: folder, IdCharset: DefaultIdCharset, IdLength: DefaultIdLength, - MaxSize: maxSize, + MaxSize: DefaultMaxSize, } } |