diff --git a/kolibri/core/assets/src/core-app/urls.js b/kolibri/core/assets/src/core-app/urls.js
index 8c054779acf..e5d9b35bd0a 100644
--- a/kolibri/core/assets/src/core-app/urls.js
+++ b/kolibri/core/assets/src/core-app/urls.js
@@ -65,6 +65,13 @@ const urls = {
}
return generateUrl(this.__contentUrl, { url: `${filename[0]}/${filename[1]}/${filename}` });
},
+ downloadUrl(fileId, extension) {
+ const filename = `${fileId}.${extension}`;
+ if (!this.__contentUrl) {
+ throw new ReferenceError('Content Url is not defined');
+ }
+ return generateUrl(this.__contentUrl, { url: `${filename[0]}/${filename[1]}/${filename}` });
+ },
};
export default urls;
diff --git a/kolibri/core/assets/src/views/ContentRenderer/DownloadButton.vue b/kolibri/core/assets/src/views/ContentRenderer/DownloadButton.vue
index ba5d2247945..7aa7f929a67 100644
--- a/kolibri/core/assets/src/views/ContentRenderer/DownloadButton.vue
+++ b/kolibri/core/assets/src/views/ContentRenderer/DownloadButton.vue
@@ -11,6 +11,7 @@
diff --git a/kolibri/core/assets/test/download-button.spec.js b/kolibri/core/assets/test/download-button.spec.js
index c78c3733cfb..bef855ed373 100644
--- a/kolibri/core/assets/test/download-button.spec.js
+++ b/kolibri/core/assets/test/download-button.spec.js
@@ -2,17 +2,21 @@ import { mount } from '@vue/test-utils';
import store from 'kolibri.coreVue.vuex.store';
import DownloadButton from '../src/views/ContentRenderer/DownloadButton';
+jest.mock('kolibri.urls');
+
describe('download-button Component', function() {
const samplesFiles = [
{
file_size: 100000,
preset: 'high_res_video',
- download_url: '/downloadcontent/3893fd801427402ad07487c5d2d35119.mp4/Math_Low_Resolution.mp4',
+ extension: 'mp4',
+ checksum: '3893fd801427402ad07487c5d2d35119',
},
{
file_size: 500,
preset: 'thumbnail',
- download_url: '/downloadcontent/187598e1f4596bf4492f5a205922b633.jpg/Math_Thumbnail.jpg',
+ extension: 'jpg',
+ checksum: '187598e1f4596bf4492f5a205922b633',
},
];
diff --git a/kolibri/plugins/learn/assets/src/views/ContentPage.vue b/kolibri/plugins/learn/assets/src/views/ContentPage.vue
index 560d3ba17a9..5d08bd5444d 100644
--- a/kolibri/plugins/learn/assets/src/views/ContentPage.vue
+++ b/kolibri/plugins/learn/assets/src/views/ContentPage.vue
@@ -100,6 +100,7 @@