Skip to content

Commit 33d75da

Browse files
committed
Save files in local storage as group readable
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.)
1 parent 34f736c commit 33d75da

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Diff for: modules/storage/local.go

+3
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@ func (l *LocalStorage) Save(path string, r io.Reader, size int64) (int64, error)
102102
if err := util.Rename(tmp.Name(), p); err != nil {
103103
return 0, err
104104
}
105+
if err := os.Chmod(p, 0o640); err != nil {
106+
return 0, err
107+
}
105108

106109
tmpRemoved = true
107110

0 commit comments

Comments
 (0)