diff --git a/CHANGELOG.md b/CHANGELOG.md index c4072ac2108..40a25dc3ceb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ List of the most important changes for each release. +## 0.17.2 + +### Changed +- Make 'save to device' file downloads initiate immediately by @rtibbles in [#12675](https://github.com/learningequality/kolibri/pull/12675) + + ## 0.17.1 ### Added diff --git a/kolibri/__init__.py b/kolibri/__init__.py index 9502808a43c..b91aeee0f38 100755 --- a/kolibri/__init__.py +++ b/kolibri/__init__.py @@ -11,7 +11,7 @@ #: This may not be the exact version as it's subject to modification with #: get_version() - use ``kolibri.__version__`` for the exact version string. -VERSION = (0, 17, 1) +VERSION = (0, 17, 2) __author__ = "Learning Equality" __email__ = "info@learningequality.org" diff --git a/kolibri/core/assets/src/views/ContentRenderer/DownloadButton.vue b/kolibri/core/assets/src/views/ContentRenderer/DownloadButton.vue index bf93e8460d1..517320973d1 100644 --- a/kolibri/core/assets/src/views/ContentRenderer/DownloadButton.vue +++ b/kolibri/core/assets/src/views/ContentRenderer/DownloadButton.vue @@ -53,13 +53,17 @@ fileOptions() { const options = this.files.map(file => { const label = getFilePresetString(file); + const fileId = + file.preset === 'video_subtitle' && file?.lang.lang_name + ? file?.lang.lang_name + : file.checksum.slice(0, 6); return { label, url: file.storage_url, fileName: this.$tr('downloadFilename', { resourceTitle: this.nodeTitle.length ? this.nodeTitle : file.checksum, fileExtension: file.extension, - fileId: file.checksum.slice(0, 6), + fileId, }), }; }); @@ -68,26 +72,12 @@ }, methods: { download(file) { - const req = new XMLHttpRequest(); - req.open('GET', file.url, true); - req.responseType = 'blob'; - - req.onload = function () { - const blob = req.response; - const blobUrl = window.URL.createObjectURL(blob); - try { - const a = document.createElement('a'); - a.download = file.fileName; - a.href = blobUrl; - document.body.appendChild(a); - a.click(); - a.remove(); - } catch (e) { - window.open(file.url, '_blank'); - } - }; - - req.send(); + const a = document.createElement('a'); + a.download = file.fileName; + a.href = file.url; + document.body.appendChild(a); + a.click(); + a.remove(); }, }, $trs: {