fix: data dir permissions having execute for all (#493)

This commit is contained in:
Felipe Martin Garcia 2022-10-09 18:50:42 +02:00 committed by GitHub
parent d0210447d2
commit 158c52a325
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 3 deletions

View file

@ -38,7 +38,7 @@ func exportHandler(cmd *cobra.Command, args []string) {
// Make sure destination directory exist
dstDir := fp.Dir(args[0])
if err := os.MkdirAll(dstDir, os.ModePerm); err != nil {
if err := os.MkdirAll(dstDir, model.DataDirPerm); err != nil {
cError.Printf("Error crating destination directory: %s", err)
}

View file

@ -6,6 +6,7 @@ import (
fp "path/filepath"
"github.com/go-shiori/shiori/internal/database"
"github.com/go-shiori/shiori/internal/model"
apppaths "github.com/muesli/go-app-paths"
"github.com/spf13/cobra"
"golang.org/x/net/context"
@ -55,7 +56,7 @@ func preRunRootHandler(cmd *cobra.Command, args []string) {
os.Exit(1)
}
err = os.MkdirAll(dataDir, os.ModePerm)
err = os.MkdirAll(dataDir, model.DataDirPerm)
if err != nil {
cError.Printf("Failed to create data dir: %v\n", err)
os.Exit(1)

View file

@ -165,7 +165,7 @@ func downloadBookImage(url, dstPath string) error {
// At this point, the download has finished successfully.
// Prepare destination file.
err = os.MkdirAll(fp.Dir(dstPath), os.ModePerm)
err = os.MkdirAll(fp.Dir(dstPath), model.DataDirPerm)
if err != nil {
return fmt.Errorf("failed to create image dir: %v", err)
}

View file

@ -1,3 +1,7 @@
package model
// DataDirPerm the default filesystem permissions for the data directory/archives
const DataDirPerm = 0744
// DatabaseDateFormat the string formatting of datetimes for the database
const DatabaseDateFormat = "2006-01-02 15:04:05"