mirror of
https://github.com/filebrowser/filebrowser.git
synced 2026-01-23 02:35:10 +00:00
fix: files and directories are created with the correct permissions (#2966)
This commit is contained in:
parent
04e03a83b4
commit
5c5ab6b875
3 changed files with 8 additions and 6 deletions
|
|
@ -98,7 +98,7 @@ func resourcePostHandler(fileCache FileCache) handleFunc {
|
|||
|
||||
// Directories creation on POST.
|
||||
if strings.HasSuffix(r.URL.Path, "/") {
|
||||
err := d.user.Fs.MkdirAll(r.URL.Path, 0775) //nolint:gomnd
|
||||
err := d.user.Fs.MkdirAll(r.URL.Path, files.PermDir)
|
||||
return errToStatus(err), err
|
||||
}
|
||||
|
||||
|
|
@ -256,12 +256,12 @@ func addVersionSuffix(source string, fs afero.Fs) string {
|
|||
|
||||
func writeFile(fs afero.Fs, dst string, in io.Reader) (os.FileInfo, error) {
|
||||
dir, _ := path.Split(dst)
|
||||
err := fs.MkdirAll(dir, 0775) //nolint:gomnd
|
||||
err := fs.MkdirAll(dir, files.PermDir)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
file, err := fs.OpenFile(dst, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0775) //nolint:gomnd
|
||||
file, err := fs.OpenFile(dst, os.O_RDWR|os.O_CREATE|os.O_TRUNC, files.PermFile)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue