From bb79aab60a40e485d144bfac10d70fbe213eb30c Mon Sep 17 00:00:00 2001 From: daurnimator Date: Sun, 12 Nov 2017 19:00:12 +1100 Subject: src/lauxlib.js: Add encodeURI call into luaL_loadfilex to match loadlib.js In future this should create a uri from lua string rather than potentially throwing errors in to_jsstring --- src/lauxlib.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/lauxlib.js b/src/lauxlib.js index 24d2203..8d110ea 100644 --- a/src/lauxlib.js +++ b/src/lauxlib.js @@ -740,9 +740,10 @@ if (WEB) { } else { lua.lua_pushfstring(L, lua.to_luastring("@%s"), filename); - let jsfilename = lua.to_jsstring(filename); + let path = lua.to_jsstring(filename); + path = encodeURI(path); let xhr = new XMLHttpRequest(); - xhr.open("GET", jsfilename, false); + xhr.open("GET", path, false); // TODO: find a way to load bytes instead of js string xhr.send(); -- cgit v1.2.3-70-g09d2