Fix a few other bugs

This commit is contained in:
Olivier Gagnon 2021-08-21 11:30:31 -04:00
parent 4de20f8cce
commit 4b8e63f342
3 changed files with 8 additions and 3 deletions

File diff suppressed because one or more lines are too long

@ -2149,11 +2149,15 @@ function NetscriptFunctions(workerScript) {
}
return port.write(data);
} else if (isString(port)) { // Write to script or text file
const fn = removeLeadingSlash(port);
let fn = port;
if (!isValidFilePath(fn)) {
throw makeRuntimeErrorMsg("write", `Invalid filepath: ${fn}`);
}
if(fn.lastIndexOf("/") === 0) {
fn = removeLeadingSlash(fn);
}
// Coerce 'data' to be a string
try {
data = String(data);

@ -94,7 +94,8 @@ function ScriptLogPopup(props: IProps): React.ReactElement {
}
export function logBoxCreate(script: RunningScript): void {
const id = script.filename+script.args.map((x: any): string => `${x}`).join('');
const id = script.server+"-"+script.filename+script.args.map((x: any): string => `${x}`).join('-');
if(document.getElementById(id) !== null) return;
const container = createElement("div", {
class: "log-box-container",
id: id,