From e9494dd4b33c8e099886251b36a3f897598f788d Mon Sep 17 00:00:00 2001 From: Jared Vititoe Date: Tue, 8 Sep 2026 10:54:45 -0400 Subject: [PATCH] Use server-verified mime_type for attachment thumbnail detection (#60) renderAttachments() decided whether to render an image thumbnail by regex-matching the display filename extension, rather than the finfo-verified mime_type the API already returns. A file whose real type differs from its display name (e.g. a PDF a user named photo.png) rendered a broken instead of falling back to the file-type icon. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01MGDKHiU5RJdo3dqQUDow3X --- assets/js/ticket.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/js/ticket.js b/assets/js/ticket.js index 3495475..316ee34 100644 --- a/assets/js/ticket.js +++ b/assets/js/ticket.js @@ -1048,7 +1048,7 @@ function renderAttachments(attachments) { }); const uploadDate = `${lt.time.ago(att.uploaded_at)}`; - const isImage = /\.(png|jpe?g|gif|webp|svg|bmp)$/i.test(att.original_filename); + const isImage = /^image\//i.test(att.mime_type || ''); const imgUrl = `/api/download_attachment.php?id=${att.attachment_id}&inline=1`; const iconHtml = isImage ? `