fix a few things

This commit is contained in:
Olivier Gagnon
2021-08-20 14:39:24 -04:00
parent 6e1100750e
commit dcddc0c2d5
10 changed files with 77 additions and 51 deletions

View File

@@ -172,6 +172,7 @@ import { isString } from "../utils/helpers/isString";
import { createElement } from "../utils/uiHelpers/createElement";
import { createPopup } from "../utils/uiHelpers/createPopup";
import { removeElementById } from "../utils/uiHelpers/removeElementById";
import { removeLeadingSlash } from "./Terminal/DirectoryHelpers";
const defaultInterpreter = new Interpreter('', () => undefined);
@@ -2149,7 +2150,7 @@ function NetscriptFunctions(workerScript) {
}
return port.write(data);
} else if (isString(port)) { // Write to script or text file
const fn = port;
const fn = removeLeadingSlash(port);
if (!isValidFilePath(fn)) {
throw makeRuntimeErrorMsg("write", `Invalid filepath: ${fn}`);
}