Skip to content

Commit

Permalink
Save files in local storage as group readable
Browse files Browse the repository at this point in the history
Go creates temporary files as 600 (https://github.com/golang/go/blob/334a591a3f4d868368913328b3e81ddf5b0f46fa/src/os/tempfile.go#L44), but sometimes we want the group to be able to read them (for example, for another user to back up the storage.)
  • Loading branch information
catdevnull committed Sep 18, 2022
1 parent 34f736c commit 33d75da
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions modules/storage/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ func (l *LocalStorage) Save(path string, r io.Reader, size int64) (int64, error)
if err := util.Rename(tmp.Name(), p); err != nil {
return 0, err
}
if err := os.Chmod(p, 0o640); err != nil {
return 0, err
}

tmpRemoved = true

Expand Down

0 comments on commit 33d75da

Please sign in to comment.