A bunch of fixes

This commit is contained in:
blankhex committed 2026-10-16 11:34:34 +03:00
1 parent 65534ecfd5
commit 2a4e03e611
20 files changed
+146 -160

No files matched your search

-3
View File
@@ -39,8 +39,6 @@ func VerifyImageLimit(r io.Reader) error {
}
func ExtractUploadedImageBytes(r *http.Request, formKey string) ([]byte, string, error) {
// Read file with a size limit to prevent abuse. We read the raw multipart
// bytes, verify size and image format, then return them.
const maxRead = MaxUploadSize + 1024 // small extra for multipart framing
file, header, err := r.FormFile(formKey)
@@ -54,7 +52,6 @@ func ExtractUploadedImageBytes(r *http.Request, formKey string) ([]byte, string,
return nil, "", fmt.Errorf("invalid file type: only JPG or PNG are allowed")
}
// Read all bytes so we can verify image dimensions from a reusable reader.
lr := io.LimitReader(file, maxRead)
fileBytes, err := io.ReadAll(lr)
if err != nil {