diff --git a/files/file.go b/files/file.go index 1daf384b..a077b062 100644 --- a/files/file.go +++ b/files/file.go @@ -23,6 +23,8 @@ import ( "github.com/filebrowser/filebrowser/v2/rules" ) +const PERM = 0664 + // FileInfo describes a file. type FileInfo struct { *Listing diff --git a/http/tus_handlers.go b/http/tus_handlers.go index 4f4d507e..8df38d4b 100644 --- a/http/tus_handlers.go +++ b/http/tus_handlers.go @@ -3,12 +3,14 @@ package http import ( "errors" "fmt" - "github.com/filebrowser/filebrowser/v2/files" - "github.com/spf13/afero" "io" "net/http" "os" "strconv" + + "github.com/spf13/afero" + + "github.com/filebrowser/filebrowser/v2/files" ) func tusPostHandler() handleFunc { @@ -42,7 +44,7 @@ func tusPostHandler() handleFunc { } } - openFile, err := d.user.Fs.OpenFile(r.URL.Path, fileFlags, 0664) + openFile, err := d.user.Fs.OpenFile(r.URL.Path, fileFlags, files.PERM) if err != nil { return errToStatus(err), err } @@ -121,7 +123,7 @@ func tusPatchHandler() handleFunc { ) } - openFile, err := d.user.Fs.OpenFile(r.URL.Path, os.O_WRONLY|os.O_APPEND, 0664) + openFile, err := d.user.Fs.OpenFile(r.URL.Path, os.O_WRONLY|os.O_APPEND, files.PERM) if err != nil { return http.StatusInternalServerError, fmt.Errorf("could not open file: %v", err) }