Skip to content

Commit c309f0a

Browse files
committed
fix: Golang security checks by gosec #104
1 parent e379d72 commit c309f0a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

internal/updater/updater.go

+7-2
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,15 @@ func UpdateConfInDir(rootDir string, outputDir string, indent int, indentChar st
117117
output = filepath.Join(outputDir, relPath)
118118
}
119119

120-
os.MkdirAll(filepath.Dir(output), 0700)
120+
err = os.MkdirAll(filepath.Dir(output), 0700)
121+
if err != nil {
122+
fmt.Printf("Formatter Nginx Conf %s failed, can not prepare the save dir\n", err)
123+
return err
124+
}
125+
121126
err = os.WriteFile(output, []byte(DecodeEscapeChars(modifiedData)), 0600)
122127
if err != nil {
123-
fmt.Printf("Formatter Nginx Conf %s failed, can not save the file\n", output)
128+
fmt.Printf("Formatter Nginx Conf %s failed, can not save the file\n", err)
124129
return err
125130
}
126131

0 commit comments

Comments
 (0)