commit be03f19a05842496b479109c2a81d06a1c4fa2e8
parent b3df42fc3cd96a14624878d89db1ae4ed0d3a617
Author: n0tr1v <n0tr1v@protonmail.com>
Date: Wed, 15 Feb 2023 03:01:37 -0800
reorder conditions
Diffstat:
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/pkg/web/handlers/api/v1/uploadInterceptor.go b/pkg/web/handlers/api/v1/uploadInterceptor.go
@@ -41,12 +41,12 @@ func handleUploadedFile(file multipart.File, handler *multipart.FileHeader, auth
if handler.Size > config.MaxUserFileUploadSize {
return nil, fmt.Errorf("the maximum file size is %s", humanize.Bytes(config.MaxUserFileUploadSize))
}
- if !govalidator.IsPrintableASCII(origFileName) {
- return nil, errors.New("file name must be ascii printable only")
- }
if !govalidator.StringLength(origFileName, "3", "50") {
return nil, errors.New("invalid file name, 3-50 characters")
}
+ if !govalidator.IsPrintableASCII(origFileName) {
+ return nil, errors.New("file name must be ascii printable only")
+ }
origFileName = tzRgx.ReplaceAllString(origFileName, "xxxx-xx-xx at xx.xx.xx XX")
origFileName = tz1Rgx.ReplaceAllString(origFileName, "xxxx-xx-xx xx-xx-xx")
fileBytes, err := ioutil.ReadAll(file)