Skip to content

Commit c7c1457

Browse files
committed
Allow relative file URLs
1 parent 5b76399 commit c7c1457

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

vm.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,7 @@ NT = {
323323
35: '↪', // #: Unique string
324324
64: '⌾', // @: make point
325325
94: '⇑', // ^: return
326+
95: '←', // _: assignment
326327
96: 'ⓢ', // `: 's operator
327328
1: '◦', // ^A: At
328329
3: '⦂', // ^C: open Colon
@@ -3920,9 +3921,12 @@ Object.subclass('St78.vm.Primitives',
39203921
// if fileName is empty or ends in slash, answer array of files
39213922
var result;
39223923
if (/http(s)?:/.test(fileName)) {
3923-
alertOK("fetching " + fileName);
3924-
// we switched to https but the image may still use http
3924+
// if url does not have a double slash after http: then remove
3925+
// the protocol so the browser will use it as relative URL
3926+
if (!/http(s)?:\/\//.test(fileName)) fileName = fileName.replace(/http(s)?:/, '');
3927+
// HACK: we switched to https but the image may still use http
39253928
fileName = fileName.replace(/^http:(\/\/lively-web.org\/)/, 'https:$1');
3929+
alertOK("fetching " + fileName);
39263930
var isDir = /\/$/.test(fileName), // ends in slash
39273931
unfreeze = this.vm.freeze(), // freeze VM until we get result
39283932
xhr = new XMLHttpRequest();

0 commit comments

Comments
 (0)