Skip to content

Commit cf6414a

Browse files
committed
Revert fix for download file and using content_disposition query arg
1 parent aaf8897 commit cf6414a

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

isimip_data/metadata/assets/js/api/DatasetApi.js

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -92,18 +92,13 @@ class DatasetApi {
9292

9393
static downloadFile(file) {
9494
if (file.file_url) {
95-
fetch(file.file_url)
96-
.then(response => response.blob())
97-
.then(blob => {
98-
const url = URL.createObjectURL(blob)
99-
const a = document.createElement('a')
100-
a.href = url
101-
a.download = file.name
102-
document.body.appendChild(a)
103-
a.click()
104-
document.body.removeChild(a)
105-
URL.revokeObjectURL(url)
106-
})
95+
const a = document.createElement('a')
96+
a.href = file.file_url + '?content_disposition=attachment'
97+
a.download = file.name
98+
a.rel = 'noopener noreferrer'
99+
document.body.appendChild(a)
100+
a.click()
101+
document.body.removeChild(a)
107102
}
108103
}
109104
}

0 commit comments

Comments
 (0)