diff --git a/database/db.go b/database/db.go index 45197f7f..8c079755 100644 --- a/database/db.go +++ b/database/db.go @@ -6,7 +6,6 @@ import ( "bytes" "errors" "io" - "io/fs" "log" "os" "path" @@ -133,7 +132,7 @@ func isTableEmpty(tableName string) (bool, error) { // InitDB sets up the database connection, migrates models, and runs seeders. func InitDB(dbPath string) error { dir := path.Dir(dbPath) - err := os.MkdirAll(dir, fs.ModePerm) + err := os.MkdirAll(dir, 0755) if err != nil { return err } diff --git a/web/service/server.go b/web/service/server.go index e828cc39..5dfb6d62 100644 --- a/web/service/server.go +++ b/web/service/server.go @@ -7,7 +7,6 @@ import ( "encoding/json" "fmt" "io" - "io/fs" "mime/multipart" "net/http" "os" @@ -660,7 +659,7 @@ func (s *ServerService) UpdateXray(version string) error { defer zipFile.Close() os.MkdirAll(filepath.Dir(fileName), 0755) os.Remove(fileName) - file, err := os.OpenFile(fileName, os.O_CREATE|os.O_RDWR|os.O_TRUNC, fs.ModePerm) + file, err := os.OpenFile(fileName, os.O_CREATE|os.O_RDWR|os.O_TRUNC, 0755) if err != nil { return err } diff --git a/xray/process.go b/xray/process.go index e76ffcf3..14372243 100644 --- a/xray/process.go +++ b/xray/process.go @@ -5,7 +5,6 @@ import ( "encoding/json" "errors" "fmt" - "io/fs" "os" "os/exec" "runtime" @@ -321,7 +320,7 @@ func (p *process) Start() (err error) { if p.configPath != "" { configPath = p.configPath } - err = os.WriteFile(configPath, data, fs.ModePerm) + err = os.WriteFile(configPath, data, 0644) if err != nil { return common.NewErrorf("Failed to write configuration file: %v", err) } @@ -381,5 +380,5 @@ func (p *process) Stop() error { // writeCrashReport writes a crash report to the binary folder with a timestamped filename. func writeCrashReport(m []byte) error { crashReportPath := config.GetBinFolderPath() + "/core_crash_" + time.Now().Format("20060102_150405") + ".log" - return os.WriteFile(crashReportPath, m, os.ModePerm) + return os.WriteFile(crashReportPath, m, 0644) }