Skip to content

Commit d7ffd03

Browse files
committed
Fix filename rewrite
1 parent 3563dd8 commit d7ffd03

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

httpimages/httpimages.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,12 @@ func (cfg *UploaderConfig) HandleAvatarUploadToFile(r *http.Request, fileKey str
7878
return "", http.StatusBadRequest, err
7979
}
8080
format, _, extension := FormatAndContentTypeForImgType(exportType)
81-
err = imgio.Save(resourcePathAfter, img, format)
81+
f, err := os.Create(resourcePathAfter)
82+
if err != nil {
83+
return "", http.StatusInternalServerError, err
84+
}
85+
defer f.Close()
86+
err = imgio.Encode(f, img, format)
8287
if err != nil {
8388
return "", http.StatusInternalServerError, err
8489
}

0 commit comments

Comments
 (0)