Skip to content

Commit bbfdf57

Browse files
yaustarsteveny-sc
andauthored
Added Base64 and blob check in Asset#getAbsoluteUrl (playcanvas#3159)
* Added Base64 and blob check in Asset#getAbsoluteUrl * Update src/asset/asset.js Co-authored-by: Steven Yau <syau@snapchat.com>
1 parent 5cd4bf6 commit bbfdf57

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/asset/asset.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,11 +230,16 @@ class Asset extends EventHandler {
230230
* @private
231231
* @function
232232
* @name Asset#getAbsoluteUrl
233-
* @description Construct an asset URL from this asset's location and a relative path.
233+
* @description Construct an asset URL from this asset's location and a relative path. If the relativePath is a
234+
* blob or Base64 URI, then return that instead.
234235
* @param {string} relativePath - The relative path to be concatenated to this asset's base url.
235236
* @returns {string} Resulting URL of the asset.
236237
*/
237238
getAbsoluteUrl(relativePath) {
239+
if (relativePath.startsWith('blob:') || relativePath.startsWith('data:')) {
240+
return relativePath;
241+
}
242+
238243
var base = path.getDirectory(this.file.url);
239244
return path.join(base, relativePath);
240245
}

0 commit comments

Comments
 (0)