limit progress to 1, remove domain from chunk url

This commit is contained in:
j 2016-08-27 19:45:43 +02:00
parent 11e36b550e
commit 343ab26aa4

View file

@ -75,9 +75,9 @@ pandora.chunkupload = function(options) {
} }
chunkURL = response.uploadUrl; chunkURL = response.uploadUrl;
if (chunkURL) { if (chunkURL) {
if (document.location.protocol == 'https:') { // only take local part of url
chunkURL = chunkURL.replace(/http:\/\//, 'https://'); var url = Ox.parseURL(chunkURL);
} chunkURL = url.pathname + url.search;
that.status = 'uploading'; that.status = 'uploading';
that.progress = 0.0; that.progress = 0.0;
// start upload // start upload
@ -136,7 +136,7 @@ pandora.chunkupload = function(options) {
done(); done();
} }
progress(parseFloat(chunkOffset)/bytesAvailable); progress(Math.min(parseFloat(chunkOffset)/bytesAvailable), 1);
request = new XMLHttpRequest(); request = new XMLHttpRequest();
request.addEventListener('load', function (evt) { request.addEventListener('load', function (evt) {