Fix #221: image pastes scale to fit, no code box, accurate size, raw serves image
CI / test (pull_request) Successful in 49s
CI / docker (pull_request) Skipped

- paste view: image attachments render in a scalable preview (max-height
  min(70vh, 720px), object-fit contain) and the code box is omitted;
  wrap/copy buttons hidden for image pastes
- SizeHuman/stats summary show the attachment size for file pastes
  (row.Content is empty for file pastes, was showing 0 B)
- /raw/{id} on a file paste streams the attachment bytes inline with its
  sniffed mime and filename instead of an empty text/plain body
This commit is contained in:
fen
2026-09-10 14:16:31 -05:00
parent 7c7e60375c
commit 6d9f9592b5
4 changed files with 77 additions and 5 deletions
+13 -1
View File
@@ -216,7 +216,8 @@ body {
.tag { font-size: 19.8px; color: var(--muted-fg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 2px 9px; }
.paste-title-bar { display: flex; align-items: center; gap: 12px; padding: 12px 18px; flex-wrap: wrap; }
.paste-title-bar h1 { font-size: 29.2px; font-weight: 600; margin: 0; word-break: normal; overflow-wrap: anywhere; }
.stats-pill { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
/* #222: overflow:hidden clips the element's own 1px border thin at the radius; inset shadow isn't clipped */
.stats-pill { border: 0; box-shadow: inset 0 0 0 1px var(--border); border-radius: var(--radius); overflow: hidden; }
.stats-head { display: flex; align-items: center; gap: 16px; width: 100%; background: none; border: 0; border-bottom: 1px solid var(--border); color: var(--muted-fg); font: inherit; font-size: 21.6px; padding: 14px 18px; cursor: pointer; text-align: left; }
.stats-head:hover { color: var(--fg); background: var(--surface-2); }
.stats-chev { width: 18px; height: 18px; flex: none; transition: transform 0.15s ease; }
@@ -819,6 +820,17 @@ button[type="submit"]:focus-visible,
.attachment-chip:hover { border-color: var(--accent); }
.attachment-chip .attachment-size { color: var(--muted-fg); font-size: 19px; }
.attachment-preview img { max-width: 480px; max-height: 360px; border-radius: var(--radius); border: 1px solid var(--border); }
/* #221: image pastes scale to fit the available box; no fixed pixel cap */
.attachment-preview.is-image img {
display: block;
max-width: 100%;
max-height: min(70vh, 720px);
width: auto;
height: auto;
object-fit: contain;
border-radius: var(--radius);
border: 1px solid var(--border);
}
/* #139: CSP-safe replacements for inline style attributes (style-src 'self') */
.hidden { display: none; }