aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/media-utility.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-04-19 10:18:31 -0400
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-04-19 10:18:31 -0400
commit16893b52b141938a32027049b71cc6c6f46dfb93 (patch)
treec6e0cc3120f80bb8bb633747e880890600646341 /ext/bg/js/media-utility.js
parent7faaf4e45737dd06ab3fdf189bd9c1d26ad1349d (diff)
Make getFileNameExtension properly handle directory separators
Diffstat (limited to 'ext/bg/js/media-utility.js')
-rw-r--r--ext/bg/js/media-utility.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/ext/bg/js/media-utility.js b/ext/bg/js/media-utility.js
index febc509a..8a46cb49 100644
--- a/ext/bg/js/media-utility.js
+++ b/ext/bg/js/media-utility.js
@@ -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':