Add change summaries, inline diff hunks and screenshots to reviews

This commit is contained in:
Ian Gulliver
2026-10-15 19:02:33 -07:00
parent ed40d91a42
commit a2067c2ba0
14 changed files with 442 additions and 32 deletions
+3 -12
View File
@@ -10,20 +10,11 @@ import (
"g.fc.run/misc/byre/internal/store"
)
const maxBlobBytes = 5 << 20
var imageTypes = map[string]bool{
"image/png": true,
"image/jpeg": true,
"image/gif": true,
"image/webp": true,
}
func (s *Server) UploadBlob(w http.ResponseWriter, r *http.Request) {
data, err := io.ReadAll(http.MaxBytesReader(w, r.Body, maxBlobBytes))
data, err := io.ReadAll(http.MaxBytesReader(w, r.Body, store.MaxBlobBytes))
maxErr := &http.MaxBytesError{}
if errors.As(err, &maxErr) {
writeError(w, http.StatusRequestEntityTooLarge, fmt.Errorf("images are limited to %d MiB", maxBlobBytes>>20))
writeError(w, http.StatusRequestEntityTooLarge, fmt.Errorf("images are limited to %d MiB", store.MaxBlobBytes>>20))
return
}
if err != nil {
@@ -32,7 +23,7 @@ func (s *Server) UploadBlob(w http.ResponseWriter, r *http.Request) {
}
contentType := http.DetectContentType(data)
if !imageTypes[contentType] {
if !store.ImageTypes[contentType] {
writeError(w, http.StatusBadRequest, fmt.Errorf("unsupported image type %s; use PNG, JPEG, GIF or WebP", contentType))
return
}