Skip to content

Commit 17ed707

Browse files
committed
The Loader.path was being added to the File URL even if the URL was absolute. This is now checked for and the path is not applied unless the URL is relative phaserjs#5301
1 parent ae06786 commit 17ed707

1 file changed

Lines changed: 13 additions & 11 deletions

File tree

src/loader/File.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,18 @@ var File = new Class({
7777

7878
if (!this.type || !this.key)
7979
{
80-
throw new Error('Error calling \'Loader.' + this.type + '\' invalid key provided.');
80+
throw new Error('Invalid Loader.' + this.type + ' key');
81+
}
82+
83+
var url = GetFastValue(fileConfig, 'url');
84+
85+
if (url === undefined)
86+
{
87+
url = loader.path + loadKey + '.' + GetFastValue(fileConfig, 'extension', '');
88+
}
89+
else if (typeof url === 'string' && !url.match(/^(?:blob:|data:|http:\/\/|https:\/\/|\/\/)/))
90+
{
91+
url = loader.path + url;
8192
}
8293

8394
/**
@@ -91,16 +102,7 @@ var File = new Class({
91102
* @type {object|string}
92103
* @since 3.0.0
93104
*/
94-
this.url = GetFastValue(fileConfig, 'url');
95-
96-
if (this.url === undefined)
97-
{
98-
this.url = loader.path + loadKey + '.' + GetFastValue(fileConfig, 'extension', '');
99-
}
100-
else if (typeof this.url === 'string' && this.url.indexOf('blob:') !== 0 && this.url.indexOf('data:') !== 0)
101-
{
102-
this.url = loader.path + this.url;
103-
}
105+
this.url = url;
104106

105107
/**
106108
* The final URL this file will load from, including baseURL and path.

0 commit comments

Comments
 (0)