diff --git a/index.html b/index.html index 9945064..91d4877 100644 --- a/index.html +++ b/index.html @@ -110,8 +110,9 @@ .then(res => res.ok ? res.json() : Promise.reject(new Error(`Server responded ${res.status}`))) .then(data => (status.textContent = 'Downloading file...', fetch(data.current_version.file.url).then(res => res.ok ? res.blob() : Promise.reject(new Error(`File download failed: ${res.status}`))).then(blob => ({blob, url: data.current_version.file.url})))) .then(({blob, url}) => { - const a = document.createElement('a'), fileName = url.split('/').pop().replace(/\.xpi$/, '.zip'); - a.href = URL.createObjectURL(blob); + const zipBlob = new Blob([blob], { type: 'application/zip' }), fileName = url.split('/').pop().replace(/\.xpi$/, '.zip'); + const a = document.createElement('a'); + a.href = URL.createObjectURL(zipBlob); a.download = fileName; document.body.appendChild(a).click(); URL.revokeObjectURL(a.href);