@samitouri / QOSami-HFS / commits / 54e0c334

fix: upload could let pass files that don't match 'accept'

Massimo Melina committed May 16, 2023 at 22:38 UTC 54e0c3343e1f67e151235636a9830186f57830cb
1 file changed +1 -1
frontend/src/upload.ts
+1 -1
@@ -252,7 +252,7 @@ function simulateBrowserAccept(f: File) {
252 if (!accept) return true
253 return normalizeAccept(accept)!.split(/ *[|,] */).some(pattern =>
254 pattern.startsWith('.') ? f.name.endsWith(pattern)
255 - : f.type.match(pattern.replace('*', '.*'))
255 + : f.type.match(pattern.replace('.','\\.').replace('*', '.*')) // '.' for .ext and '*' for 'image/*'
256 )
257 }
258