From 81bdad4bebdc8ee19c01d8b44012e89daef6930b Mon Sep 17 00:00:00 2001 From: Elscrux Date: Sun, 2 Jun 2024 19:23:52 +0000 Subject: [PATCH] fix: ignore casing to check if file extensions can be previewed (#2341) Now .PNG is supported as well as .PnG and so on Co-authored-by: Elscrux Reviewed-on: https://kolaente.dev/vikunja/vikunja/pulls/2341 Co-authored-by: Elscrux Co-committed-by: Elscrux --- frontend/src/components/tasks/partials/attachments.vue | 2 +- frontend/src/components/tasks/partials/file-preview.vue | 2 +- frontend/src/components/tasks/partials/kanban-card.vue | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/tasks/partials/attachments.vue b/frontend/src/components/tasks/partials/attachments.vue index 5c6be0fe8..32bcf4127 100644 --- a/frontend/src/components/tasks/partials/attachments.vue +++ b/frontend/src/components/tasks/partials/attachments.vue @@ -273,7 +273,7 @@ async function viewOrDownload(attachment: IAttachment) { } function canPreview(attachment: IAttachment): boolean { - return SUPPORTED_IMAGE_SUFFIX.some((suffix) => attachment.file.name.endsWith(suffix)) + return SUPPORTED_IMAGE_SUFFIX.some((suffix) => attachment.file.name.toLowerCase().endsWith(suffix)) } const copy = useCopyToClipboard() diff --git a/frontend/src/components/tasks/partials/file-preview.vue b/frontend/src/components/tasks/partials/file-preview.vue index 7e2fd9a63..0043f963d 100644 --- a/frontend/src/components/tasks/partials/file-preview.vue +++ b/frontend/src/components/tasks/partials/file-preview.vue @@ -41,7 +41,7 @@ watchEffect(async () => { }) function canPreview(attachment: IAttachment): boolean { - return SUPPORTED_IMAGE_SUFFIX.some((suffix) => attachment.file.name.endsWith(suffix)) + return SUPPORTED_IMAGE_SUFFIX.some((suffix) => attachment.file.name.toLowerCase().endsWith(suffix)) } diff --git a/frontend/src/components/tasks/partials/kanban-card.vue b/frontend/src/components/tasks/partials/kanban-card.vue index 6b66f5831..ee26ad42f 100644 --- a/frontend/src/components/tasks/partials/kanban-card.vue +++ b/frontend/src/components/tasks/partials/kanban-card.vue @@ -162,7 +162,7 @@ async function maybeDownloadCoverImage() { } const attachment = task.attachments.find(a => a.id === task.coverImageAttachmentId) - if (!attachment || !SUPPORTED_IMAGE_SUFFIX.some((suffix) => attachment.file.name.endsWith(suffix))) { + if (!attachment || !SUPPORTED_IMAGE_SUFFIX.some((suffix) => attachment.file.name.toLowerCase().endsWith(suffix))) { return }