From 4897acf92e6825e9bdae2952454dfa811dc4c9b1 Mon Sep 17 00:00:00 2001 From: Oleg Lobanov Date: Fri, 28 Jul 2023 15:19:52 +0200 Subject: [PATCH] fix backend lint --- files/file.go | 2 ++ http/tus_handlers.go | 10 ++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) 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) }