fix(permission): globalize and fixes

Permission alert frop OpenGrep is wrong, as the directory must use 0755.
To make things working and to ease futur changes, I set the default
permission in a constant.
This commit is contained in:
2025-07-06 11:39:19 +02:00
parent e58948bb44
commit 09c2c86d59
6 changed files with 18 additions and 12 deletions

View File

@@ -6,6 +6,7 @@ import (
"image/color"
"image/png"
"katenary/generator/labels"
"katenary/utils"
"log"
"os"
"path/filepath"
@@ -68,7 +69,7 @@ services:
// create a static directory with an index.html file
staticDir := tmpDir + "/static"
os.Mkdir(staticDir, 0o755)
os.Mkdir(staticDir, utils.DirectoryPermission)
indexFile, err := os.Create(staticDir + "/index.html")
if err != nil {
t.Errorf("Failed to create index.html: %s", err)
@@ -128,7 +129,7 @@ services:
// create a static directory with an index.html file
staticDir := tmpDir + "/static"
os.Mkdir(staticDir, 0o755)
os.Mkdir(staticDir, utils.DirectoryPermission)
indexFile, err := os.Create(staticDir + "/index.html")
if err != nil {
t.Errorf("Failed to create index.html: %s", err)
@@ -174,7 +175,7 @@ services:
log.Println(tmpDir)
defer teardown(tmpDir)
os.Mkdir(filepath.Join(tmpDir, "images"), 0o755)
os.Mkdir(filepath.Join(tmpDir, "images"), utils.DirectoryPermission)
// create a png image
pngFile := tmpDir + "/images/foo.png"
@@ -244,7 +245,7 @@ services:
log.Println(tmpDir)
defer teardown(tmpDir)
os.Mkdir(filepath.Join(tmpDir, "images"), 0o755)
os.Mkdir(filepath.Join(tmpDir, "images"), utils.DirectoryPermission)
// create a png image
pngFile := tmpDir + "/images/foo.png"