Make getFileNameExtension properly handle directory separators
This commit is contained in:
parent
7faaf4e457
commit
16893b52b1
@ -16,13 +16,13 @@
|
||||
*/
|
||||
|
||||
const mediaUtility = (() => {
|
||||
function getFileNameExtension(fileName) {
|
||||
const match = /\.[^.]*$/.exec(fileName);
|
||||
function getFileNameExtension(path) {
|
||||
const match = /\.[^./\\]*$/.exec(path);
|
||||
return match !== null ? match[0] : '';
|
||||
}
|
||||
|
||||
function getImageMediaTypeFromFileName(fileName) {
|
||||
switch (getFileNameExtension(fileName).toLowerCase()) {
|
||||
function getImageMediaTypeFromFileName(path) {
|
||||
switch (getFileNameExtension(path).toLowerCase()) {
|
||||
case '.apng':
|
||||
return 'image/apng';
|
||||
case '.bmp':
|
||||
|
Loading…
Reference in New Issue
Block a user