mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-10-24 06:48:02 +08:00
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.
This commit is contained in:
parent
31585bd0b2
commit
af0f23c940
1 changed files with 4 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue