aboutsummaryrefslogtreecommitdiff
path: root/src/library_browser.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/library_browser.js')
-rw-r--r--src/library_browser.js5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/library_browser.js b/src/library_browser.js
index b1e4190b..c1add740 100644
--- a/src/library_browser.js
+++ b/src/library_browser.js
@@ -75,8 +75,7 @@ mergeInto(LibraryManager.library, {
'ogg': 'audio/ogg',
'wav': 'audio/wav',
'mp3': 'audio/mpeg'
- }[name.substr(-3)];
- return ret;
+ }[name.substr(name.lastIndexOf('.')+1)];
}
if (!Module["preloadPlugins"]) Module["preloadPlugins"] = [];
@@ -380,7 +379,7 @@ mergeInto(LibraryManager.library, {
xhr.open('GET', url, true);
xhr.responseType = 'arraybuffer';
xhr.onload = function() {
- if (xhr.status == 200) {
+ if (xhr.status == 200 || (xhr.status == 0 && xhr.response)) { // file URLs can return 0
onload(xhr.response);
} else {
onerror();