mirror of
https://github.com/minio/minio.git
synced 2024-12-24 22:25:54 -05:00
Browser: Fix Safari Blob download issue (#4357)
This commit is contained in:
parent
1886d94e95
commit
a767ad321a
@ -432,6 +432,8 @@ export const setLoginError = () => {
|
|||||||
|
|
||||||
export const downloadSelected = (url, req, xhr) => {
|
export const downloadSelected = (url, req, xhr) => {
|
||||||
return (dispatch) => {
|
return (dispatch) => {
|
||||||
|
var anchor = document.createElement('a')
|
||||||
|
document.body.appendChild(anchor);
|
||||||
xhr.open('POST', url, true)
|
xhr.open('POST', url, true)
|
||||||
xhr.responseType = 'blob'
|
xhr.responseType = 'blob'
|
||||||
|
|
||||||
@ -439,10 +441,20 @@ export const downloadSelected = (url, req, xhr) => {
|
|||||||
if (this.status == 200) {
|
if (this.status == 200) {
|
||||||
dispatch(checkedObjectsReset())
|
dispatch(checkedObjectsReset())
|
||||||
var blob = new Blob([this.response], {
|
var blob = new Blob([this.response], {
|
||||||
type: 'application/zip'
|
type: 'octet/stream'
|
||||||
})
|
})
|
||||||
var blobUrl = window.URL.createObjectURL(blob);
|
var blobUrl = window.URL.createObjectURL(blob);
|
||||||
window.location = blobUrl
|
var separator = req.prefix.length > 1 ? '-' : ''
|
||||||
|
|
||||||
|
anchor.href = blobUrl
|
||||||
|
anchor.download = req.bucketName+separator+req.prefix.slice(0, -1)+'.zip';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
anchor.click()
|
||||||
|
window.URL.revokeObjectURL(blobUrl)
|
||||||
|
anchor.remove()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
xhr.send(JSON.stringify(req));
|
xhr.send(JSON.stringify(req));
|
||||||
|
Loading…
Reference in New Issue
Block a user