mirror of
https://github.com/JannisX11/blockbench.git
synced 2025-01-18 15:26:19 +08:00
Merge pull request #1486 from Gingeh/export-extensions
Check for a valid file extension when exporting, fixes #1485
This commit is contained in:
commit
94e6e31ab6
@ -275,7 +275,8 @@ Object.assign(Blockbench, {
|
||||
*/
|
||||
if (Blockbench.isWeb) {
|
||||
var file_name = options.name || 'file';
|
||||
if (options.extensions && file_name.substr(-options.extensions[0].length) != options.extensions[0]) {
|
||||
var extension = pathToExtension(file_name);
|
||||
if (options.extensions instanceof Array && !options.extensions.includes(extension) && options.extensions[0]) {
|
||||
file_name += '.' + options.extensions[0];
|
||||
}
|
||||
if (options.custom_writer) {
|
||||
@ -326,7 +327,7 @@ Object.assign(Blockbench, {
|
||||
StateMemory.save('dialog_paths')
|
||||
}
|
||||
var extension = pathToExtension(file_path);
|
||||
if (!extension && options.extensions && options.extensions[0]) {
|
||||
if (options.extensions instanceof Array && !options.extensions.includes(extension) && options.extensions[0]) {
|
||||
file_path += '.'+options.extensions[0]
|
||||
}
|
||||
Blockbench.writeFile(file_path, options, cb)
|
||||
|
Loading…
Reference in New Issue
Block a user