summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/loadlib.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/loadlib.js b/src/loadlib.js
index 04314b7..d1d5423 100644
--- a/src/loadlib.js
+++ b/src/loadlib.js
@@ -39,6 +39,7 @@ let lsys_load;
if (WEB) {
lsys_load = function(L, path, seeglb) {
path = lua.to_jsstring(path);
+ path = encodeURI(path);
let xhr = new XMLHttpRequest();
xhr.open("GET", path, false);
xhr.send();
@@ -130,10 +131,12 @@ if (!WEB) {
};
} else {
/* TODO: use async/await ? */
- readable = function(filename) {
+ readable = function(path) {
+ path = lua.to_jsstring(path);
+ path = encodeURI(path);
let xhr = new XMLHttpRequest();
/* Following GET request done by searcher_Web will be cached */
- xhr.open("GET", lua.to_jsstring(filename), false);
+ xhr.open("GET", path, false);
xhr.send();
return xhr.status >= 200 && xhr.status <= 299;