diff --git a/src/NetscriptFunctions.ts b/src/NetscriptFunctions.ts index ffae723fa..1a0f49a4d 100644 --- a/src/NetscriptFunctions.ts +++ b/src/NetscriptFunctions.ts @@ -1626,7 +1626,7 @@ export const ns: InternalAPI = { }); }); }, - wget: (ctx) => async (_url, _target, _hostname) => { + wget: (ctx) => (_url, _target, _hostname) => { const url = helpers.string(ctx, "url", _url); const target = helpers.filePath(ctx, "target", _target); const hostname = _hostname ? helpers.string(ctx, "hostname", _hostname) : ctx.workerScript.hostname; @@ -1640,11 +1640,7 @@ export const ns: InternalAPI = { url, function (data) { let res; - if (hasScriptExtension(target)) { - res = server.writeToScriptFile(target, data); - } else { - res = server.writeToTextFile(target, data); - } + res = server.writeToContentFile(target, data); if (res.overwritten) { helpers.log(ctx, () => `Successfully retrieved content and overwrote '${target}' on '${hostname}'`); return resolve(true); diff --git a/src/Paths/ProgramFilePath.ts b/src/Paths/ProgramFilePath.ts index 54a45a549..ebc190544 100644 --- a/src/Paths/ProgramFilePath.ts +++ b/src/Paths/ProgramFilePath.ts @@ -9,7 +9,7 @@ export type ProgramFilePath = FilePath & WithProgramExtension; export function hasProgramExtension(path: string): path is WithProgramExtension { if (path.endsWith(".exe")) return true; const extension = path.substring(path.indexOf(".")); - return /^\.exe-[0-9]{1-2}\.[0-9]{2}%-INC$/.test(extension); + return /^\.exe-[0-9]{1,2}\.[0-9]{2}%-INC$/.test(extension); } /** Sanitize a player input, resolve any relative paths, and for imports add the correct extension if missing */