From af0f23c9404f4d01b0222d5cacfc6060fca912b5 Mon Sep 17 00:00:00 2001 From: Seif Soliman Date: Tue, 5 Aug 2025 14:57:26 +0300 Subject: [PATCH] fix: font file type check for better browser compatibility (@byseif21) (#6836) ### Description * browsers don't provide accurate MIME types for font files , I couldn't even reuse the site fonts as local fonts. * Validation now checks both MIME type and file extension to ensure valid fonts aren't mistakenly rejected. --- frontend/src/ts/elements/settings/custom-font-picker.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frontend/src/ts/elements/settings/custom-font-picker.ts b/frontend/src/ts/elements/settings/custom-font-picker.ts index 6891ada8f..6384a2275 100644 --- a/frontend/src/ts/elements/settings/custom-font-picker.ts +++ b/frontend/src/ts/elements/settings/custom-font-picker.ts @@ -52,7 +52,10 @@ uploadContainerEl } // check type - if (!file.type.match(/font\/(woff|woff2|ttf|otf)/)) { + if ( + !file.type.match(/font\/(woff|woff2|ttf|otf)/) && + !file.name.match(/\.(woff|woff2|ttf|otf)$/i) + ) { Notifications.add( "Unsupported font format, must be woff, woff2, ttf or otf.", 0