From 1246a455f3e68b199988b2df61cfedb8bfc25404 Mon Sep 17 00:00:00 2001 From: the-djmaze <3752035+the-djmaze@users.noreply.github.com> Date: Mon, 2 Nov 2026 18:16:40 +0100 Subject: [PATCH] Ask the browser properly whether it can preview a PDF https://github.com/kimusan/Tachyon/commit/8086beb6c212b905a0ddce1409f5a7ead0e6c595 --- dev/Model/Attachment.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/dev/Model/Attachment.js b/dev/Model/Attachment.js index 93fbc42f4..4a83dcafd 100644 --- a/dev/Model/Attachment.js +++ b/dev/Model/Attachment.js @@ -104,7 +104,18 @@ export class AttachmentModel extends AbstractModel { * @returns {boolean} */ pdfPreview() { - return null != navigator.mimeTypes['application/pdf'] && FileType.Pdf === this.fileType; + /** + * navigator.pdfViewerEnabled is the supported way to ask this. + * navigator.mimeTypes is deprecated and browsers now expose a PDF entry + * there only while the built in viewer is on, so the old check quietly + * returned false in cases where a preview would have worked and took + * the eye badge with it. + */ + return FileType.Pdf === this.fileType + && (undefined !== navigator.pdfViewerEnabled + ? navigator.pdfViewerEnabled + : null != navigator.mimeTypes['application/pdf'] + ); } /**