diff --git a/src/app.js b/src/app.js index 598ce2b..d2deea6 100644 --- a/src/app.js +++ b/src/app.js @@ -154,11 +154,6 @@ add_image_format("image/bmp;bpp=8", "256 Color Bitmap (*.bmp;*.dib)"); add_image_format("image/bmp;bpp=24", "24-bit Bitmap (*.bmp;*.dib)"); // add_image_format("image/bmp;bpp=32", "32-bit Bitmap (*.bmp;*.dib)"); -const get_file_extension = filePathOrName => { - const splitByDots = filePathOrName.split(/\./g); - return splitByDots[splitByDots.length - 1].toLowerCase(); -}; - const palette_formats = []; for (const [format_id, format] of Object.entries(AnyPalette.formats)) { if (format.write) { diff --git a/src/electron-injected.js b/src/electron-injected.js index 0c8877a..089c289 100644 --- a/src/electron-injected.js +++ b/src/electron-injected.js @@ -68,8 +68,7 @@ const get_image_format_from_extension = (file_path_or_name_or_ext)=> { }; window.save_to_file_path = (canvas, filePath, savedCallback) => { - - const extension = get_file_extension(filePath); + const extension = (filePath.indexOf(/\./) > -1) && filePath.split(/\./g).pop().toLowerCase(); if (!extension) { // @TODO: Linux/Unix?? you're not supposed to need file extensions return show_error_message("Missing file extension - Try adding .png to the end of the file name");