test: improve upload permission coverage

This commit is contained in:
Herrtian 2026-05-22 13:09:13 +02:00
parent a3e91a0053
commit ca0bc54ee1

View File

@ -740,9 +740,10 @@ func (c *Context) SaveUploadedFile(file *multipart.FileHeader, dst string, perm
// Only chmod newly created directories. Attempting to chmod
// pre-existing directories (e.g. /tmp) may fail with EPERM.
if !dirExisted {
if err = os.Chmod(dir, mode); err != nil {
return err
err = os.Chmod(dir, mode)
}
if err != nil {
return err
}
out, err := os.Create(dst)