Improve image api.

This commit is contained in:
2025-06-26 18:56:16 +08:00
parent 8f57365975
commit ea29064573
2 changed files with 6 additions and 2 deletions

View File

@@ -110,7 +110,11 @@ func CreateImage(uid uint, ip string, data []byte) (uint, error) {
// If the image is still too large after conversion, return an error
if len(data) > 1024*1024*4 {
return 0, model.NewRequestError("Image data is too large after conversion")
return 0, model.NewRequestError("Image data is too large")
}
// Normal user has a smaller upload limit
if !canUpload && len(data) > 1024*1024*2 {
return 0, model.NewRequestError("Image data is too large")
}
filename := uuid.New().String()