From aec829ad85ab589ceee6c25870109c06ac8d132a Mon Sep 17 00:00:00 2001 From: Jason Streifling Date: Fri, 4 Oct 2024 12:10:12 +0200 Subject: [PATCH] Fixed a bug that returned the wrong filename for an uploaded image --- cmd/backend/images.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/backend/images.go b/cmd/backend/images.go index 367ed3a..f66c74a 100644 --- a/cmd/backend/images.go +++ b/cmd/backend/images.go @@ -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) }