fix #221: scale image pastes, drop text box, fix raw view and size
CI / test (pull_request) Successful in 45s
CI / docker (pull_request) Skipped

- image pastes render the image scaled to fit the viewer box (aspect
  ratio preserved, max-height 70vh), no text/code box below it
- link pill moved under the image as a small inline chip
- /raw serves image attachment bytes as an image instead of empty text
- view details size reports the actual attachment file size
This commit is contained in:
fen
2026-09-10 14:19:07 -05:00
parent 44cff7e718
commit 98ea7eefa9
5 changed files with 80 additions and 9 deletions
+11
View File
@@ -91,6 +91,17 @@ func (l *limitReader) Read(p []byte) (int, error) {
return n, err
}
// isImageMime reports whether the sniffed mime is a raster image the viewer
// can render inline (#221). SVG is excluded: it is forced to text/plain on
// serving by the active-content rule and must never render as an image.
func isImageMime(mime string) bool {
switch mime {
case "image/png", "image/jpeg", "image/gif", "image/webp":
return true
}
return false
}
// handleCreatePasteMultipart implements POST /api/pastes with
// multipart/form-data (#38). Fields mirror the JSON create path; a 'file'
// part makes the paste a file paste (1 file = 1 paste: if text content is