#1773 - Fix duplicate file extensions

For some time now, filenames have included the extension, so there's no need to append ".js" either on a single-file download or zip download.

While I was in the area, I also fixed .txt files in a folder - they had the same bug as scripts used to (appear in the zip as an underscore). I consolidated the code since it was the same for script files and text files.

I also added the ability to download *.js and *.ns (previously only supported *, *.script, and *.txt)

I also made the wildcard matching just a bit more flexible, so if someone really wanted to, they could go "download *blah.js" and get all scripts ending with that pattern ¯\_(ツ)_/¯
This commit is contained in:
Alain Bryden
2021-11-25 23:06:13 -04:00
parent f0a004e75b
commit ef23033b2c
2 changed files with 22 additions and 36 deletions

View File

@@ -56,7 +56,7 @@ export class Script {
* Download the script as a file
*/
download(): void {
const filename = this.filename + ".js";
const filename = this.filename;
const file = new Blob([this.code], { type: "text/plain" });
const navigator = window.navigator as any;
if (navigator.msSaveOrOpenBlob) {