fixes for firefox and safari:

- ensure progress bar % works on ff, and safari
- don't use URL for parsing custom schemes due to browser differences
- add error messaging for interrupted download
This commit is contained in:
Ilya Kreymer
2020-05-07 11:11:14 -07:00
parent 1cf32c7de4
commit 5f148a8325
4 changed files with 132 additions and 93 deletions
+32 -1
View File
@@ -39,8 +39,39 @@ async function sourceToId(url) {
return {url, coll};
}
// simple parse of scheme, host, rest of path
// not using URL due to different browser behavior
function parseURLSchemeHostPath(url) {
let inx = url.indexOf("://");
let hostInx = 0;
let scheme = "";
let host = "";
let path = "";
if (inx >= 0) {
scheme = url.slice(0, inx);
inx += 3;
} else {
inx++;
if (url.startsWith("//")) {
inx += 2;
}
}
hostInx = url.indexOf("/", inx);
if (hostInx > 0) {
host = url.slice(inx, hostInx);
path = url.slice(hostInx);
} else {
host = url.slice(inx);
path = "";
}
return {scheme, host, path};
}
export { digestMessage, tsToDate, getTS, sourceToId };
export { digestMessage, tsToDate, getTS, sourceToId, parseURLSchemeHostPath };