diff --git a/src/NetscriptFunctions.ts b/src/NetscriptFunctions.ts index 875016bd8..06f0bbb68 100644 --- a/src/NetscriptFunctions.ts +++ b/src/NetscriptFunctions.ts @@ -828,7 +828,10 @@ export const ns: InternalAPI = { let noFailures = true; //ts detects files as any[] here even though we would have thrown in the above loop if it wasn't string[] - for (const file of files as string[]) { + for (let file of files as string[]) { + // cut off the leading / for files in the root of the server; this assumes that the filename is somewhat normalized and doesn't look like `//file.js` + if (file.startsWith("/") && file.indexOf("/", 1) === -1) file = file.slice(1); + // Scp for lit files if (file.endsWith(".lit")) { const sourceMessage = sourceServ.messages.find((message) => message === file);