summaryrefslogtreecommitdiffhomepage
path: root/helpers
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2018-11-14 17:44:04 +0100
committerBjørn Erik Pedersen <[email protected]>2018-11-14 23:14:51 +0100
commitfabf026f4937bf6fbbb944aa7d6e721839ae4c92 (patch)
tree636cc176125a237404b8688003001ac792374da6 /helpers
parent94f0f7e59788e802e706a55cac0d52a9e70ff745 (diff)
downloadhugo-fabf026f4937bf6fbbb944aa7d6e721839ae4c92.tar.gz
hugo-fabf026f4937bf6fbbb944aa7d6e721839ae4c92.zip
helpers: Add a comment about file mode for new files
See #5434
Diffstat (limited to 'helpers')
-rw-r--r--helpers/path.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/helpers/path.go b/helpers/path.go
index f5096e62f..92b58de84 100644
--- a/helpers/path.go
+++ b/helpers/path.go
@@ -563,12 +563,13 @@ func OpenFilesForWriting(fs afero.Fs, filenames ...string) (io.WriteCloser, erro
func OpenFileForWriting(fs afero.Fs, filename string) (afero.File, error) {
filename = filepath.Clean(filename)
// Create will truncate if file already exists.
+ // os.Create will create any new files with mode 0666 (before umask).
f, err := fs.Create(filename)
if err != nil {
if !os.IsNotExist(err) {
return nil, err
}
- if err = fs.MkdirAll(filepath.Dir(filename), 0777); err != nil { // rwx, rw, r before umask
+ if err = fs.MkdirAll(filepath.Dir(filename), 0777); err != nil { // before umask
return nil, err
}
f, err = fs.Create(filename)