fix: potential file inclusion via variable

This commit is contained in:
lilong.129
2025-04-28 19:59:21 +08:00
parent 4d7dc466f3
commit 427cc1dab2
6 changed files with 7 additions and 7 deletions

View File

@@ -418,7 +418,7 @@ func TestLoadImage(t *testing.T) {
// loadImage loads image and returns base64 encoded string
func loadImage(imagePath string) (base64Str string, size types.Size, err error) {
// Read the image file
imageFile, err := os.Open(imagePath)
imageFile, err := os.OpenFile(imagePath, os.O_RDONLY, 0o666)
if err != nil {
return "", types.Size{}, fmt.Errorf("failed to open image file: %w", err)
}