Skip to content

Commit 3c91b83

Browse files
committed
Fix bug in uploader
1 parent a2b355b commit 3c91b83

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

js/easycoder/Browser.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2591,12 +2591,23 @@ const EasyCoder_Browser = {
25912591
}
25922592
}
25932593
};
2594+
ajax.onerror = function (data) {
2595+
if (command.onError) {
2596+
program.errorMessage = this.responseText;
2597+
program.run(command.onError);
2598+
} else {
2599+
const error = this.responseText;
2600+
program.runtimeError(command.lino, error);
2601+
}
2602+
};
25942603
program.ajaxCommand = command;
25952604
const rest = document.getElementById(`easycoder-rest`);
25962605
if (!rest) {
25972606
program.runtimeError(command.lino, `No REST server defined`);
25982607
}
2599-
const postpath = path.startsWith(`http`) ? path : `${window.location.origin}${rest}/${path}`;
2608+
const postpath = path.startsWith(`http`)
2609+
? path
2610+
: `${window.location.origin}/${rest.innerText}/${path}`;
26002611
ajax.open(`POST`, postpath);
26012612
ajax.send(formData);
26022613
}

0 commit comments

Comments
 (0)