Fixed a bug that returned the wrong filename for an uploaded image

This commit is contained in:
Jason Streifling 2024-10-04 12:10:12 +02:00
parent 298ea458ca
commit aec829ad85

View File

@ -23,8 +23,8 @@ func SaveImage(c *Config, src io.Reader) (string, error) {
img = imaging.Resize(img, c.MaxImgWidth, 0, imaging.Lanczos)
}
filename := fmt.Sprint(c.PicsDir, "/", uuid.New(), ".webp")
file, err := os.Create(filename)
filename := fmt.Sprint(uuid.New(), ".webp")
file, err := os.Create(c.PicsDir + "/" + filename)
if err != nil {
return "", fmt.Errorf("error creating new image file: %v", err)
}