@instructure/canvas-rce 5.6.17 → 5.6.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/es/rce/plugins/shared/fileTypeUtils.js +14 -6
- package/es/sidebar/actions/upload.js +3 -1
- package/lib/rce/plugins/shared/fileTypeUtils.js +14 -6
- package/lib/sidebar/actions/upload.js +3 -1
- package/lib/translated/ar/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
- package/lib/translated/ar/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
- package/lib/translated/ar/modules/sidebar/actions/upload.js +3 -1
- package/lib/translated/ca/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
- package/lib/translated/ca/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
- package/lib/translated/ca/modules/sidebar/actions/upload.js +3 -1
- package/lib/translated/cy/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
- package/lib/translated/cy/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
- package/lib/translated/cy/modules/sidebar/actions/upload.js +3 -1
- package/lib/translated/da/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
- package/lib/translated/da/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
- package/lib/translated/da/modules/sidebar/actions/upload.js +3 -1
- package/lib/translated/da-x-k12/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
- package/lib/translated/da-x-k12/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
- package/lib/translated/da-x-k12/modules/sidebar/actions/upload.js +3 -1
- package/lib/translated/de/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
- package/lib/translated/de/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
- package/lib/translated/de/modules/sidebar/actions/upload.js +3 -1
- package/lib/translated/el/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
- package/lib/translated/el/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
- package/lib/translated/el/modules/sidebar/actions/upload.js +3 -1
- package/lib/translated/en/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
- package/lib/translated/en/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
- package/lib/translated/en/modules/sidebar/actions/upload.js +3 -1
- package/lib/translated/en-AU-x-unimelb/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
- package/lib/translated/en-AU-x-unimelb/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
- package/lib/translated/en-AU-x-unimelb/modules/sidebar/actions/upload.js +3 -1
- package/lib/translated/en-GB-x-ukhe/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
- package/lib/translated/en-GB-x-ukhe/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
- package/lib/translated/en-GB-x-ukhe/modules/sidebar/actions/upload.js +3 -1
- package/lib/translated/en_AU/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
- package/lib/translated/en_AU/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
- package/lib/translated/en_AU/modules/sidebar/actions/upload.js +3 -1
- package/lib/translated/en_CA/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
- package/lib/translated/en_CA/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
- package/lib/translated/en_CA/modules/sidebar/actions/upload.js +3 -1
- package/lib/translated/en_CY/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
- package/lib/translated/en_CY/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
- package/lib/translated/en_CY/modules/sidebar/actions/upload.js +3 -1
- package/lib/translated/en_GB/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
- package/lib/translated/en_GB/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
- package/lib/translated/en_GB/modules/sidebar/actions/upload.js +3 -1
- package/lib/translated/es/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
- package/lib/translated/es/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
- package/lib/translated/es/modules/sidebar/actions/upload.js +3 -1
- package/lib/translated/es_ES/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
- package/lib/translated/es_ES/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
- package/lib/translated/es_ES/modules/sidebar/actions/upload.js +3 -1
- package/lib/translated/es_GT/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
- package/lib/translated/es_GT/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
- package/lib/translated/es_GT/modules/sidebar/actions/upload.js +3 -1
- package/lib/translated/fa_IR/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
- package/lib/translated/fa_IR/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
- package/lib/translated/fa_IR/modules/sidebar/actions/upload.js +3 -1
- package/lib/translated/fi/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
- package/lib/translated/fi/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
- package/lib/translated/fi/modules/sidebar/actions/upload.js +3 -1
- package/lib/translated/fr/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
- package/lib/translated/fr/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
- package/lib/translated/fr/modules/sidebar/actions/upload.js +3 -1
- package/lib/translated/fr_CA/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
- package/lib/translated/fr_CA/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
- package/lib/translated/fr_CA/modules/sidebar/actions/upload.js +3 -1
- package/lib/translated/he/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
- package/lib/translated/he/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
- package/lib/translated/he/modules/sidebar/actions/upload.js +3 -1
- package/lib/translated/ht/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
- package/lib/translated/ht/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
- package/lib/translated/ht/modules/sidebar/actions/upload.js +3 -1
- package/lib/translated/hu/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
- package/lib/translated/hu/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
- package/lib/translated/hu/modules/sidebar/actions/upload.js +3 -1
- package/lib/translated/hy/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
- package/lib/translated/hy/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
- package/lib/translated/hy/modules/sidebar/actions/upload.js +3 -1
- package/lib/translated/is/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
- package/lib/translated/is/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
- package/lib/translated/is/modules/sidebar/actions/upload.js +3 -1
- package/lib/translated/it/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
- package/lib/translated/it/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
- package/lib/translated/it/modules/sidebar/actions/upload.js +3 -1
- package/lib/translated/ja/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
- package/lib/translated/ja/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
- package/lib/translated/ja/modules/sidebar/actions/upload.js +3 -1
- package/lib/translated/ko/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
- package/lib/translated/ko/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
- package/lib/translated/ko/modules/sidebar/actions/upload.js +3 -1
- package/lib/translated/mi/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
- package/lib/translated/mi/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
- package/lib/translated/mi/modules/sidebar/actions/upload.js +3 -1
- package/lib/translated/ms/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
- package/lib/translated/ms/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
- package/lib/translated/ms/modules/sidebar/actions/upload.js +3 -1
- package/lib/translated/nb/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
- package/lib/translated/nb/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
- package/lib/translated/nb/modules/sidebar/actions/upload.js +3 -1
- package/lib/translated/nb-x-k12/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
- package/lib/translated/nb-x-k12/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
- package/lib/translated/nb-x-k12/modules/sidebar/actions/upload.js +3 -1
- package/lib/translated/nl/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
- package/lib/translated/nl/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
- package/lib/translated/nl/modules/sidebar/actions/upload.js +3 -1
- package/lib/translated/nn/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
- package/lib/translated/nn/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
- package/lib/translated/nn/modules/sidebar/actions/upload.js +3 -1
- package/lib/translated/pl/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
- package/lib/translated/pl/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
- package/lib/translated/pl/modules/sidebar/actions/upload.js +3 -1
- package/lib/translated/pt/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
- package/lib/translated/pt/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
- package/lib/translated/pt/modules/sidebar/actions/upload.js +3 -1
- package/lib/translated/pt_BR/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
- package/lib/translated/pt_BR/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
- package/lib/translated/pt_BR/modules/sidebar/actions/upload.js +3 -1
- package/lib/translated/ru/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
- package/lib/translated/ru/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
- package/lib/translated/ru/modules/sidebar/actions/upload.js +3 -1
- package/lib/translated/se/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
- package/lib/translated/se/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
- package/lib/translated/se/modules/sidebar/actions/upload.js +3 -1
- package/lib/translated/sl/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
- package/lib/translated/sl/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
- package/lib/translated/sl/modules/sidebar/actions/upload.js +3 -1
- package/lib/translated/sv/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
- package/lib/translated/sv/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
- package/lib/translated/sv/modules/sidebar/actions/upload.js +3 -1
- package/lib/translated/sv-x-k12/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
- package/lib/translated/sv-x-k12/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
- package/lib/translated/sv-x-k12/modules/sidebar/actions/upload.js +3 -1
- package/lib/translated/sv_SE/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
- package/lib/translated/sv_SE/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
- package/lib/translated/sv_SE/modules/sidebar/actions/upload.js +3 -1
- package/lib/translated/tg/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
- package/lib/translated/tg/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
- package/lib/translated/tg/modules/sidebar/actions/upload.js +3 -1
- package/lib/translated/th/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
- package/lib/translated/th/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
- package/lib/translated/th/modules/sidebar/actions/upload.js +3 -1
- package/lib/translated/th_TH/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
- package/lib/translated/th_TH/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
- package/lib/translated/th_TH/modules/sidebar/actions/upload.js +3 -1
- package/lib/translated/tr/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
- package/lib/translated/tr/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
- package/lib/translated/tr/modules/sidebar/actions/upload.js +3 -1
- package/lib/translated/uk_UA/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
- package/lib/translated/uk_UA/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
- package/lib/translated/uk_UA/modules/sidebar/actions/upload.js +3 -1
- package/lib/translated/vi/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
- package/lib/translated/vi/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
- package/lib/translated/vi/modules/sidebar/actions/upload.js +3 -1
- package/lib/translated/vi_VN/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
- package/lib/translated/vi_VN/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
- package/lib/translated/vi_VN/modules/sidebar/actions/upload.js +3 -1
- package/lib/translated/zh/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
- package/lib/translated/zh/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
- package/lib/translated/zh/modules/sidebar/actions/upload.js +3 -1
- package/lib/translated/zh-Hans/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
- package/lib/translated/zh-Hans/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
- package/lib/translated/zh-Hans/modules/sidebar/actions/upload.js +3 -1
- package/lib/translated/zh-Hant/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
- package/lib/translated/zh-Hant/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
- package/lib/translated/zh-Hant/modules/sidebar/actions/upload.js +3 -1
- package/lib/translated/zh_HK/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
- package/lib/translated/zh_HK/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
- package/lib/translated/zh_HK/modules/sidebar/actions/upload.js +3 -1
- package/package.json +3 -2
- package/scripts/publishToNpm.sh +77 -0
- package/canvas/README.md +0 -84
- package/canvas/locales/en.json +0 -934
- package/canvas/package.json +0 -189
|
@@ -138,11 +138,22 @@ describe('fileTypeUtils', () => {
|
|
|
138
138
|
it('uses attachment route if id is present', () => {
|
|
139
139
|
const file = {
|
|
140
140
|
id: '123',
|
|
141
|
-
type: 'video/mov'
|
|
141
|
+
type: 'video/mov',
|
|
142
|
+
uuid: 'abc'
|
|
142
143
|
};
|
|
143
144
|
const url = mediaPlayerURLFromFile(file);
|
|
144
145
|
expect(url).toBe('/media_attachments_iframe/123?type=video&embedded=true');
|
|
145
146
|
});
|
|
147
|
+
it('uses adds the uuid if the context is User', () => {
|
|
148
|
+
const file = {
|
|
149
|
+
id: '123',
|
|
150
|
+
type: 'video/mov',
|
|
151
|
+
contextType: 'User',
|
|
152
|
+
uuid: 'abc'
|
|
153
|
+
};
|
|
154
|
+
const url = mediaPlayerURLFromFile(file);
|
|
155
|
+
expect(url).toBe('/media_attachments_iframe/123?type=video&embedded=true&verifier=abc');
|
|
156
|
+
});
|
|
146
157
|
it('uses the file verifier if present', () => {
|
|
147
158
|
const file = {
|
|
148
159
|
id: '123',
|
|
@@ -150,7 +161,7 @@ describe('fileTypeUtils', () => {
|
|
|
150
161
|
url: 'host?verifier=something'
|
|
151
162
|
};
|
|
152
163
|
const url = mediaPlayerURLFromFile(file);
|
|
153
|
-
expect(url).toBe('/media_attachments_iframe/123?type=video&verifier=something
|
|
164
|
+
expect(url).toBe('/media_attachments_iframe/123?type=video&embedded=true&verifier=something');
|
|
154
165
|
});
|
|
155
166
|
it('uses media_object route if no attachmentId exists', () => {
|
|
156
167
|
const file = {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* You should have received a copy of the GNU Affero General Public License along
|
|
16
16
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
17
|
*/
|
|
18
|
-
import { parse } from 'url';
|
|
18
|
+
import { format, parse } from 'url';
|
|
19
19
|
import { absoluteToRelativeUrl } from '../../../common/fileUrl';
|
|
20
20
|
import { IconAudioLine, IconDocumentLine, IconMsExcelLine, IconMsPptLine, IconMsWordLine, IconPdfLine, IconVideoLine } from '@instructure/ui-icons';
|
|
21
21
|
import RCEGlobals from '../../RCEGlobals';
|
|
@@ -94,13 +94,21 @@ export function mediaPlayerURLFromFile(file, canvasOrigin) {
|
|
|
94
94
|
const type = content_type.replace(/\/.*$/, '');
|
|
95
95
|
|
|
96
96
|
if ((_RCEGlobals$getFeatur = RCEGlobals.getFeatures()) !== null && _RCEGlobals$getFeatur !== void 0 && _RCEGlobals$getFeatur.media_links_use_attachment_id && isAudioOrVideo(content_type) && file.id) {
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
const url = parse(`/media_attachments_iframe/${file.id}`, true);
|
|
98
|
+
url.query.type = type;
|
|
99
|
+
url.query.embedded = true;
|
|
100
|
+
|
|
101
|
+
if (file.uuid && file.contextType == 'User') {
|
|
102
|
+
url.query.verifier = file.uuid;
|
|
103
|
+
} else if (file.url || file.href) {
|
|
104
|
+
const parsed_url = parse(file.url || file.href, true);
|
|
105
|
+
|
|
106
|
+
if (parsed_url.query.verifier) {
|
|
107
|
+
url.query.verifier = parsed_url.query.verifier;
|
|
108
|
+
}
|
|
99
109
|
}
|
|
100
110
|
|
|
101
|
-
|
|
102
|
-
const verifier = parsed_url.query.verifier ? `&verifier=${parsed_url.query.verifier}` : '';
|
|
103
|
-
return `/media_attachments_iframe/${file.id}?type=${type}${verifier}&embedded=true`;
|
|
111
|
+
return format(url);
|
|
104
112
|
}
|
|
105
113
|
|
|
106
114
|
if (file.embedded_iframe_url) {
|
|
@@ -272,7 +272,9 @@ export function mediaUploadComplete(error, uploadData) {
|
|
|
272
272
|
media_id: mediaObject.media_object.media_id,
|
|
273
273
|
type: uploadedFile.type,
|
|
274
274
|
title: uploadedFile.title || uploadedFile.name,
|
|
275
|
-
id: mediaObject.media_object.attachment_id
|
|
275
|
+
id: mediaObject.media_object.attachment_id,
|
|
276
|
+
uuid: mediaObject.media_object.uuid,
|
|
277
|
+
contextType: mediaObject.media_object.context_type
|
|
276
278
|
};
|
|
277
279
|
dispatch(removePlaceholdersFor(uploadedFile.name));
|
|
278
280
|
embedUploadResult(embedData, 'media');
|
|
@@ -138,11 +138,22 @@ describe('fileTypeUtils', () => {
|
|
|
138
138
|
it('uses attachment route if id is present', () => {
|
|
139
139
|
const file = {
|
|
140
140
|
id: '123',
|
|
141
|
-
type: 'video/mov'
|
|
141
|
+
type: 'video/mov',
|
|
142
|
+
uuid: 'abc'
|
|
142
143
|
};
|
|
143
144
|
const url = mediaPlayerURLFromFile(file);
|
|
144
145
|
expect(url).toBe('/media_attachments_iframe/123?type=video&embedded=true');
|
|
145
146
|
});
|
|
147
|
+
it('uses adds the uuid if the context is User', () => {
|
|
148
|
+
const file = {
|
|
149
|
+
id: '123',
|
|
150
|
+
type: 'video/mov',
|
|
151
|
+
contextType: 'User',
|
|
152
|
+
uuid: 'abc'
|
|
153
|
+
};
|
|
154
|
+
const url = mediaPlayerURLFromFile(file);
|
|
155
|
+
expect(url).toBe('/media_attachments_iframe/123?type=video&embedded=true&verifier=abc');
|
|
156
|
+
});
|
|
146
157
|
it('uses the file verifier if present', () => {
|
|
147
158
|
const file = {
|
|
148
159
|
id: '123',
|
|
@@ -150,7 +161,7 @@ describe('fileTypeUtils', () => {
|
|
|
150
161
|
url: 'host?verifier=something'
|
|
151
162
|
};
|
|
152
163
|
const url = mediaPlayerURLFromFile(file);
|
|
153
|
-
expect(url).toBe('/media_attachments_iframe/123?type=video&verifier=something
|
|
164
|
+
expect(url).toBe('/media_attachments_iframe/123?type=video&embedded=true&verifier=something');
|
|
154
165
|
});
|
|
155
166
|
it('uses media_object route if no attachmentId exists', () => {
|
|
156
167
|
const file = {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* You should have received a copy of the GNU Affero General Public License along
|
|
16
16
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
17
|
*/
|
|
18
|
-
import { parse } from 'url';
|
|
18
|
+
import { format, parse } from 'url';
|
|
19
19
|
import { absoluteToRelativeUrl } from '../../../common/fileUrl';
|
|
20
20
|
import { IconAudioLine, IconDocumentLine, IconMsExcelLine, IconMsPptLine, IconMsWordLine, IconPdfLine, IconVideoLine } from '@instructure/ui-icons';
|
|
21
21
|
import RCEGlobals from '../../RCEGlobals';
|
|
@@ -94,13 +94,21 @@ export function mediaPlayerURLFromFile(file, canvasOrigin) {
|
|
|
94
94
|
const type = content_type.replace(/\/.*$/, '');
|
|
95
95
|
|
|
96
96
|
if ((_RCEGlobals$getFeatur = RCEGlobals.getFeatures()) !== null && _RCEGlobals$getFeatur !== void 0 && _RCEGlobals$getFeatur.media_links_use_attachment_id && isAudioOrVideo(content_type) && file.id) {
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
const url = parse(`/media_attachments_iframe/${file.id}`, true);
|
|
98
|
+
url.query.type = type;
|
|
99
|
+
url.query.embedded = true;
|
|
100
|
+
|
|
101
|
+
if (file.uuid && file.contextType == 'User') {
|
|
102
|
+
url.query.verifier = file.uuid;
|
|
103
|
+
} else if (file.url || file.href) {
|
|
104
|
+
const parsed_url = parse(file.url || file.href, true);
|
|
105
|
+
|
|
106
|
+
if (parsed_url.query.verifier) {
|
|
107
|
+
url.query.verifier = parsed_url.query.verifier;
|
|
108
|
+
}
|
|
99
109
|
}
|
|
100
110
|
|
|
101
|
-
|
|
102
|
-
const verifier = parsed_url.query.verifier ? `&verifier=${parsed_url.query.verifier}` : '';
|
|
103
|
-
return `/media_attachments_iframe/${file.id}?type=${type}${verifier}&embedded=true`;
|
|
111
|
+
return format(url);
|
|
104
112
|
}
|
|
105
113
|
|
|
106
114
|
if (file.embedded_iframe_url) {
|
|
@@ -272,7 +272,9 @@ export function mediaUploadComplete(error, uploadData) {
|
|
|
272
272
|
media_id: mediaObject.media_object.media_id,
|
|
273
273
|
type: uploadedFile.type,
|
|
274
274
|
title: uploadedFile.title || uploadedFile.name,
|
|
275
|
-
id: mediaObject.media_object.attachment_id
|
|
275
|
+
id: mediaObject.media_object.attachment_id,
|
|
276
|
+
uuid: mediaObject.media_object.uuid,
|
|
277
|
+
contextType: mediaObject.media_object.context_type
|
|
276
278
|
};
|
|
277
279
|
dispatch(removePlaceholdersFor(uploadedFile.name));
|
|
278
280
|
embedUploadResult(embedData, 'media');
|
|
@@ -138,11 +138,22 @@ describe('fileTypeUtils', () => {
|
|
|
138
138
|
it('uses attachment route if id is present', () => {
|
|
139
139
|
const file = {
|
|
140
140
|
id: '123',
|
|
141
|
-
type: 'video/mov'
|
|
141
|
+
type: 'video/mov',
|
|
142
|
+
uuid: 'abc'
|
|
142
143
|
};
|
|
143
144
|
const url = mediaPlayerURLFromFile(file);
|
|
144
145
|
expect(url).toBe('/media_attachments_iframe/123?type=video&embedded=true');
|
|
145
146
|
});
|
|
147
|
+
it('uses adds the uuid if the context is User', () => {
|
|
148
|
+
const file = {
|
|
149
|
+
id: '123',
|
|
150
|
+
type: 'video/mov',
|
|
151
|
+
contextType: 'User',
|
|
152
|
+
uuid: 'abc'
|
|
153
|
+
};
|
|
154
|
+
const url = mediaPlayerURLFromFile(file);
|
|
155
|
+
expect(url).toBe('/media_attachments_iframe/123?type=video&embedded=true&verifier=abc');
|
|
156
|
+
});
|
|
146
157
|
it('uses the file verifier if present', () => {
|
|
147
158
|
const file = {
|
|
148
159
|
id: '123',
|
|
@@ -150,7 +161,7 @@ describe('fileTypeUtils', () => {
|
|
|
150
161
|
url: 'host?verifier=something'
|
|
151
162
|
};
|
|
152
163
|
const url = mediaPlayerURLFromFile(file);
|
|
153
|
-
expect(url).toBe('/media_attachments_iframe/123?type=video&verifier=something
|
|
164
|
+
expect(url).toBe('/media_attachments_iframe/123?type=video&embedded=true&verifier=something');
|
|
154
165
|
});
|
|
155
166
|
it('uses media_object route if no attachmentId exists', () => {
|
|
156
167
|
const file = {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* You should have received a copy of the GNU Affero General Public License along
|
|
16
16
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
17
|
*/
|
|
18
|
-
import { parse } from 'url';
|
|
18
|
+
import { format, parse } from 'url';
|
|
19
19
|
import { absoluteToRelativeUrl } from '../../../common/fileUrl';
|
|
20
20
|
import { IconAudioLine, IconDocumentLine, IconMsExcelLine, IconMsPptLine, IconMsWordLine, IconPdfLine, IconVideoLine } from '@instructure/ui-icons';
|
|
21
21
|
import RCEGlobals from '../../RCEGlobals';
|
|
@@ -94,13 +94,21 @@ export function mediaPlayerURLFromFile(file, canvasOrigin) {
|
|
|
94
94
|
const type = content_type.replace(/\/.*$/, '');
|
|
95
95
|
|
|
96
96
|
if ((_RCEGlobals$getFeatur = RCEGlobals.getFeatures()) !== null && _RCEGlobals$getFeatur !== void 0 && _RCEGlobals$getFeatur.media_links_use_attachment_id && isAudioOrVideo(content_type) && file.id) {
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
const url = parse(`/media_attachments_iframe/${file.id}`, true);
|
|
98
|
+
url.query.type = type;
|
|
99
|
+
url.query.embedded = true;
|
|
100
|
+
|
|
101
|
+
if (file.uuid && file.contextType == 'User') {
|
|
102
|
+
url.query.verifier = file.uuid;
|
|
103
|
+
} else if (file.url || file.href) {
|
|
104
|
+
const parsed_url = parse(file.url || file.href, true);
|
|
105
|
+
|
|
106
|
+
if (parsed_url.query.verifier) {
|
|
107
|
+
url.query.verifier = parsed_url.query.verifier;
|
|
108
|
+
}
|
|
99
109
|
}
|
|
100
110
|
|
|
101
|
-
|
|
102
|
-
const verifier = parsed_url.query.verifier ? `&verifier=${parsed_url.query.verifier}` : '';
|
|
103
|
-
return `/media_attachments_iframe/${file.id}?type=${type}${verifier}&embedded=true`;
|
|
111
|
+
return format(url);
|
|
104
112
|
}
|
|
105
113
|
|
|
106
114
|
if (file.embedded_iframe_url) {
|
|
@@ -272,7 +272,9 @@ export function mediaUploadComplete(error, uploadData) {
|
|
|
272
272
|
media_id: mediaObject.media_object.media_id,
|
|
273
273
|
type: uploadedFile.type,
|
|
274
274
|
title: uploadedFile.title || uploadedFile.name,
|
|
275
|
-
id: mediaObject.media_object.attachment_id
|
|
275
|
+
id: mediaObject.media_object.attachment_id,
|
|
276
|
+
uuid: mediaObject.media_object.uuid,
|
|
277
|
+
contextType: mediaObject.media_object.context_type
|
|
276
278
|
};
|
|
277
279
|
dispatch(removePlaceholdersFor(uploadedFile.name));
|
|
278
280
|
embedUploadResult(embedData, 'media');
|
|
@@ -138,11 +138,22 @@ describe('fileTypeUtils', () => {
|
|
|
138
138
|
it('uses attachment route if id is present', () => {
|
|
139
139
|
const file = {
|
|
140
140
|
id: '123',
|
|
141
|
-
type: 'video/mov'
|
|
141
|
+
type: 'video/mov',
|
|
142
|
+
uuid: 'abc'
|
|
142
143
|
};
|
|
143
144
|
const url = mediaPlayerURLFromFile(file);
|
|
144
145
|
expect(url).toBe('/media_attachments_iframe/123?type=video&embedded=true');
|
|
145
146
|
});
|
|
147
|
+
it('uses adds the uuid if the context is User', () => {
|
|
148
|
+
const file = {
|
|
149
|
+
id: '123',
|
|
150
|
+
type: 'video/mov',
|
|
151
|
+
contextType: 'User',
|
|
152
|
+
uuid: 'abc'
|
|
153
|
+
};
|
|
154
|
+
const url = mediaPlayerURLFromFile(file);
|
|
155
|
+
expect(url).toBe('/media_attachments_iframe/123?type=video&embedded=true&verifier=abc');
|
|
156
|
+
});
|
|
146
157
|
it('uses the file verifier if present', () => {
|
|
147
158
|
const file = {
|
|
148
159
|
id: '123',
|
|
@@ -150,7 +161,7 @@ describe('fileTypeUtils', () => {
|
|
|
150
161
|
url: 'host?verifier=something'
|
|
151
162
|
};
|
|
152
163
|
const url = mediaPlayerURLFromFile(file);
|
|
153
|
-
expect(url).toBe('/media_attachments_iframe/123?type=video&verifier=something
|
|
164
|
+
expect(url).toBe('/media_attachments_iframe/123?type=video&embedded=true&verifier=something');
|
|
154
165
|
});
|
|
155
166
|
it('uses media_object route if no attachmentId exists', () => {
|
|
156
167
|
const file = {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* You should have received a copy of the GNU Affero General Public License along
|
|
16
16
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
17
|
*/
|
|
18
|
-
import { parse } from 'url';
|
|
18
|
+
import { format, parse } from 'url';
|
|
19
19
|
import { absoluteToRelativeUrl } from '../../../common/fileUrl';
|
|
20
20
|
import { IconAudioLine, IconDocumentLine, IconMsExcelLine, IconMsPptLine, IconMsWordLine, IconPdfLine, IconVideoLine } from '@instructure/ui-icons';
|
|
21
21
|
import RCEGlobals from '../../RCEGlobals';
|
|
@@ -94,13 +94,21 @@ export function mediaPlayerURLFromFile(file, canvasOrigin) {
|
|
|
94
94
|
const type = content_type.replace(/\/.*$/, '');
|
|
95
95
|
|
|
96
96
|
if ((_RCEGlobals$getFeatur = RCEGlobals.getFeatures()) !== null && _RCEGlobals$getFeatur !== void 0 && _RCEGlobals$getFeatur.media_links_use_attachment_id && isAudioOrVideo(content_type) && file.id) {
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
const url = parse(`/media_attachments_iframe/${file.id}`, true);
|
|
98
|
+
url.query.type = type;
|
|
99
|
+
url.query.embedded = true;
|
|
100
|
+
|
|
101
|
+
if (file.uuid && file.contextType == 'User') {
|
|
102
|
+
url.query.verifier = file.uuid;
|
|
103
|
+
} else if (file.url || file.href) {
|
|
104
|
+
const parsed_url = parse(file.url || file.href, true);
|
|
105
|
+
|
|
106
|
+
if (parsed_url.query.verifier) {
|
|
107
|
+
url.query.verifier = parsed_url.query.verifier;
|
|
108
|
+
}
|
|
99
109
|
}
|
|
100
110
|
|
|
101
|
-
|
|
102
|
-
const verifier = parsed_url.query.verifier ? `&verifier=${parsed_url.query.verifier}` : '';
|
|
103
|
-
return `/media_attachments_iframe/${file.id}?type=${type}${verifier}&embedded=true`;
|
|
111
|
+
return format(url);
|
|
104
112
|
}
|
|
105
113
|
|
|
106
114
|
if (file.embedded_iframe_url) {
|
|
@@ -272,7 +272,9 @@ export function mediaUploadComplete(error, uploadData) {
|
|
|
272
272
|
media_id: mediaObject.media_object.media_id,
|
|
273
273
|
type: uploadedFile.type,
|
|
274
274
|
title: uploadedFile.title || uploadedFile.name,
|
|
275
|
-
id: mediaObject.media_object.attachment_id
|
|
275
|
+
id: mediaObject.media_object.attachment_id,
|
|
276
|
+
uuid: mediaObject.media_object.uuid,
|
|
277
|
+
contextType: mediaObject.media_object.context_type
|
|
276
278
|
};
|
|
277
279
|
dispatch(removePlaceholdersFor(uploadedFile.name));
|
|
278
280
|
embedUploadResult(embedData, 'media');
|
|
@@ -138,11 +138,22 @@ describe('fileTypeUtils', () => {
|
|
|
138
138
|
it('uses attachment route if id is present', () => {
|
|
139
139
|
const file = {
|
|
140
140
|
id: '123',
|
|
141
|
-
type: 'video/mov'
|
|
141
|
+
type: 'video/mov',
|
|
142
|
+
uuid: 'abc'
|
|
142
143
|
};
|
|
143
144
|
const url = mediaPlayerURLFromFile(file);
|
|
144
145
|
expect(url).toBe('/media_attachments_iframe/123?type=video&embedded=true');
|
|
145
146
|
});
|
|
147
|
+
it('uses adds the uuid if the context is User', () => {
|
|
148
|
+
const file = {
|
|
149
|
+
id: '123',
|
|
150
|
+
type: 'video/mov',
|
|
151
|
+
contextType: 'User',
|
|
152
|
+
uuid: 'abc'
|
|
153
|
+
};
|
|
154
|
+
const url = mediaPlayerURLFromFile(file);
|
|
155
|
+
expect(url).toBe('/media_attachments_iframe/123?type=video&embedded=true&verifier=abc');
|
|
156
|
+
});
|
|
146
157
|
it('uses the file verifier if present', () => {
|
|
147
158
|
const file = {
|
|
148
159
|
id: '123',
|
|
@@ -150,7 +161,7 @@ describe('fileTypeUtils', () => {
|
|
|
150
161
|
url: 'host?verifier=something'
|
|
151
162
|
};
|
|
152
163
|
const url = mediaPlayerURLFromFile(file);
|
|
153
|
-
expect(url).toBe('/media_attachments_iframe/123?type=video&verifier=something
|
|
164
|
+
expect(url).toBe('/media_attachments_iframe/123?type=video&embedded=true&verifier=something');
|
|
154
165
|
});
|
|
155
166
|
it('uses media_object route if no attachmentId exists', () => {
|
|
156
167
|
const file = {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* You should have received a copy of the GNU Affero General Public License along
|
|
16
16
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
17
|
*/
|
|
18
|
-
import { parse } from 'url';
|
|
18
|
+
import { format, parse } from 'url';
|
|
19
19
|
import { absoluteToRelativeUrl } from '../../../common/fileUrl';
|
|
20
20
|
import { IconAudioLine, IconDocumentLine, IconMsExcelLine, IconMsPptLine, IconMsWordLine, IconPdfLine, IconVideoLine } from '@instructure/ui-icons';
|
|
21
21
|
import RCEGlobals from '../../RCEGlobals';
|
|
@@ -94,13 +94,21 @@ export function mediaPlayerURLFromFile(file, canvasOrigin) {
|
|
|
94
94
|
const type = content_type.replace(/\/.*$/, '');
|
|
95
95
|
|
|
96
96
|
if ((_RCEGlobals$getFeatur = RCEGlobals.getFeatures()) !== null && _RCEGlobals$getFeatur !== void 0 && _RCEGlobals$getFeatur.media_links_use_attachment_id && isAudioOrVideo(content_type) && file.id) {
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
const url = parse(`/media_attachments_iframe/${file.id}`, true);
|
|
98
|
+
url.query.type = type;
|
|
99
|
+
url.query.embedded = true;
|
|
100
|
+
|
|
101
|
+
if (file.uuid && file.contextType == 'User') {
|
|
102
|
+
url.query.verifier = file.uuid;
|
|
103
|
+
} else if (file.url || file.href) {
|
|
104
|
+
const parsed_url = parse(file.url || file.href, true);
|
|
105
|
+
|
|
106
|
+
if (parsed_url.query.verifier) {
|
|
107
|
+
url.query.verifier = parsed_url.query.verifier;
|
|
108
|
+
}
|
|
99
109
|
}
|
|
100
110
|
|
|
101
|
-
|
|
102
|
-
const verifier = parsed_url.query.verifier ? `&verifier=${parsed_url.query.verifier}` : '';
|
|
103
|
-
return `/media_attachments_iframe/${file.id}?type=${type}${verifier}&embedded=true`;
|
|
111
|
+
return format(url);
|
|
104
112
|
}
|
|
105
113
|
|
|
106
114
|
if (file.embedded_iframe_url) {
|
|
@@ -272,7 +272,9 @@ export function mediaUploadComplete(error, uploadData) {
|
|
|
272
272
|
media_id: mediaObject.media_object.media_id,
|
|
273
273
|
type: uploadedFile.type,
|
|
274
274
|
title: uploadedFile.title || uploadedFile.name,
|
|
275
|
-
id: mediaObject.media_object.attachment_id
|
|
275
|
+
id: mediaObject.media_object.attachment_id,
|
|
276
|
+
uuid: mediaObject.media_object.uuid,
|
|
277
|
+
contextType: mediaObject.media_object.context_type
|
|
276
278
|
};
|
|
277
279
|
dispatch(removePlaceholdersFor(uploadedFile.name));
|
|
278
280
|
embedUploadResult(embedData, 'media');
|
|
@@ -138,11 +138,22 @@ describe('fileTypeUtils', () => {
|
|
|
138
138
|
it('uses attachment route if id is present', () => {
|
|
139
139
|
const file = {
|
|
140
140
|
id: '123',
|
|
141
|
-
type: 'video/mov'
|
|
141
|
+
type: 'video/mov',
|
|
142
|
+
uuid: 'abc'
|
|
142
143
|
};
|
|
143
144
|
const url = mediaPlayerURLFromFile(file);
|
|
144
145
|
expect(url).toBe('/media_attachments_iframe/123?type=video&embedded=true');
|
|
145
146
|
});
|
|
147
|
+
it('uses adds the uuid if the context is User', () => {
|
|
148
|
+
const file = {
|
|
149
|
+
id: '123',
|
|
150
|
+
type: 'video/mov',
|
|
151
|
+
contextType: 'User',
|
|
152
|
+
uuid: 'abc'
|
|
153
|
+
};
|
|
154
|
+
const url = mediaPlayerURLFromFile(file);
|
|
155
|
+
expect(url).toBe('/media_attachments_iframe/123?type=video&embedded=true&verifier=abc');
|
|
156
|
+
});
|
|
146
157
|
it('uses the file verifier if present', () => {
|
|
147
158
|
const file = {
|
|
148
159
|
id: '123',
|
|
@@ -150,7 +161,7 @@ describe('fileTypeUtils', () => {
|
|
|
150
161
|
url: 'host?verifier=something'
|
|
151
162
|
};
|
|
152
163
|
const url = mediaPlayerURLFromFile(file);
|
|
153
|
-
expect(url).toBe('/media_attachments_iframe/123?type=video&verifier=something
|
|
164
|
+
expect(url).toBe('/media_attachments_iframe/123?type=video&embedded=true&verifier=something');
|
|
154
165
|
});
|
|
155
166
|
it('uses media_object route if no attachmentId exists', () => {
|
|
156
167
|
const file = {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* You should have received a copy of the GNU Affero General Public License along
|
|
16
16
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
17
|
*/
|
|
18
|
-
import { parse } from 'url';
|
|
18
|
+
import { format, parse } from 'url';
|
|
19
19
|
import { absoluteToRelativeUrl } from '../../../common/fileUrl';
|
|
20
20
|
import { IconAudioLine, IconDocumentLine, IconMsExcelLine, IconMsPptLine, IconMsWordLine, IconPdfLine, IconVideoLine } from '@instructure/ui-icons';
|
|
21
21
|
import RCEGlobals from '../../RCEGlobals';
|
|
@@ -94,13 +94,21 @@ export function mediaPlayerURLFromFile(file, canvasOrigin) {
|
|
|
94
94
|
const type = content_type.replace(/\/.*$/, '');
|
|
95
95
|
|
|
96
96
|
if ((_RCEGlobals$getFeatur = RCEGlobals.getFeatures()) !== null && _RCEGlobals$getFeatur !== void 0 && _RCEGlobals$getFeatur.media_links_use_attachment_id && isAudioOrVideo(content_type) && file.id) {
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
const url = parse(`/media_attachments_iframe/${file.id}`, true);
|
|
98
|
+
url.query.type = type;
|
|
99
|
+
url.query.embedded = true;
|
|
100
|
+
|
|
101
|
+
if (file.uuid && file.contextType == 'User') {
|
|
102
|
+
url.query.verifier = file.uuid;
|
|
103
|
+
} else if (file.url || file.href) {
|
|
104
|
+
const parsed_url = parse(file.url || file.href, true);
|
|
105
|
+
|
|
106
|
+
if (parsed_url.query.verifier) {
|
|
107
|
+
url.query.verifier = parsed_url.query.verifier;
|
|
108
|
+
}
|
|
99
109
|
}
|
|
100
110
|
|
|
101
|
-
|
|
102
|
-
const verifier = parsed_url.query.verifier ? `&verifier=${parsed_url.query.verifier}` : '';
|
|
103
|
-
return `/media_attachments_iframe/${file.id}?type=${type}${verifier}&embedded=true`;
|
|
111
|
+
return format(url);
|
|
104
112
|
}
|
|
105
113
|
|
|
106
114
|
if (file.embedded_iframe_url) {
|
|
@@ -272,7 +272,9 @@ export function mediaUploadComplete(error, uploadData) {
|
|
|
272
272
|
media_id: mediaObject.media_object.media_id,
|
|
273
273
|
type: uploadedFile.type,
|
|
274
274
|
title: uploadedFile.title || uploadedFile.name,
|
|
275
|
-
id: mediaObject.media_object.attachment_id
|
|
275
|
+
id: mediaObject.media_object.attachment_id,
|
|
276
|
+
uuid: mediaObject.media_object.uuid,
|
|
277
|
+
contextType: mediaObject.media_object.context_type
|
|
276
278
|
};
|
|
277
279
|
dispatch(removePlaceholdersFor(uploadedFile.name));
|
|
278
280
|
embedUploadResult(embedData, 'media');
|
|
@@ -138,11 +138,22 @@ describe('fileTypeUtils', () => {
|
|
|
138
138
|
it('uses attachment route if id is present', () => {
|
|
139
139
|
const file = {
|
|
140
140
|
id: '123',
|
|
141
|
-
type: 'video/mov'
|
|
141
|
+
type: 'video/mov',
|
|
142
|
+
uuid: 'abc'
|
|
142
143
|
};
|
|
143
144
|
const url = mediaPlayerURLFromFile(file);
|
|
144
145
|
expect(url).toBe('/media_attachments_iframe/123?type=video&embedded=true');
|
|
145
146
|
});
|
|
147
|
+
it('uses adds the uuid if the context is User', () => {
|
|
148
|
+
const file = {
|
|
149
|
+
id: '123',
|
|
150
|
+
type: 'video/mov',
|
|
151
|
+
contextType: 'User',
|
|
152
|
+
uuid: 'abc'
|
|
153
|
+
};
|
|
154
|
+
const url = mediaPlayerURLFromFile(file);
|
|
155
|
+
expect(url).toBe('/media_attachments_iframe/123?type=video&embedded=true&verifier=abc');
|
|
156
|
+
});
|
|
146
157
|
it('uses the file verifier if present', () => {
|
|
147
158
|
const file = {
|
|
148
159
|
id: '123',
|
|
@@ -150,7 +161,7 @@ describe('fileTypeUtils', () => {
|
|
|
150
161
|
url: 'host?verifier=something'
|
|
151
162
|
};
|
|
152
163
|
const url = mediaPlayerURLFromFile(file);
|
|
153
|
-
expect(url).toBe('/media_attachments_iframe/123?type=video&verifier=something
|
|
164
|
+
expect(url).toBe('/media_attachments_iframe/123?type=video&embedded=true&verifier=something');
|
|
154
165
|
});
|
|
155
166
|
it('uses media_object route if no attachmentId exists', () => {
|
|
156
167
|
const file = {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* You should have received a copy of the GNU Affero General Public License along
|
|
16
16
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
17
|
*/
|
|
18
|
-
import { parse } from 'url';
|
|
18
|
+
import { format, parse } from 'url';
|
|
19
19
|
import { absoluteToRelativeUrl } from '../../../common/fileUrl';
|
|
20
20
|
import { IconAudioLine, IconDocumentLine, IconMsExcelLine, IconMsPptLine, IconMsWordLine, IconPdfLine, IconVideoLine } from '@instructure/ui-icons';
|
|
21
21
|
import RCEGlobals from '../../RCEGlobals';
|
|
@@ -94,13 +94,21 @@ export function mediaPlayerURLFromFile(file, canvasOrigin) {
|
|
|
94
94
|
const type = content_type.replace(/\/.*$/, '');
|
|
95
95
|
|
|
96
96
|
if ((_RCEGlobals$getFeatur = RCEGlobals.getFeatures()) !== null && _RCEGlobals$getFeatur !== void 0 && _RCEGlobals$getFeatur.media_links_use_attachment_id && isAudioOrVideo(content_type) && file.id) {
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
const url = parse(`/media_attachments_iframe/${file.id}`, true);
|
|
98
|
+
url.query.type = type;
|
|
99
|
+
url.query.embedded = true;
|
|
100
|
+
|
|
101
|
+
if (file.uuid && file.contextType == 'User') {
|
|
102
|
+
url.query.verifier = file.uuid;
|
|
103
|
+
} else if (file.url || file.href) {
|
|
104
|
+
const parsed_url = parse(file.url || file.href, true);
|
|
105
|
+
|
|
106
|
+
if (parsed_url.query.verifier) {
|
|
107
|
+
url.query.verifier = parsed_url.query.verifier;
|
|
108
|
+
}
|
|
99
109
|
}
|
|
100
110
|
|
|
101
|
-
|
|
102
|
-
const verifier = parsed_url.query.verifier ? `&verifier=${parsed_url.query.verifier}` : '';
|
|
103
|
-
return `/media_attachments_iframe/${file.id}?type=${type}${verifier}&embedded=true`;
|
|
111
|
+
return format(url);
|
|
104
112
|
}
|
|
105
113
|
|
|
106
114
|
if (file.embedded_iframe_url) {
|
|
@@ -272,7 +272,9 @@ export function mediaUploadComplete(error, uploadData) {
|
|
|
272
272
|
media_id: mediaObject.media_object.media_id,
|
|
273
273
|
type: uploadedFile.type,
|
|
274
274
|
title: uploadedFile.title || uploadedFile.name,
|
|
275
|
-
id: mediaObject.media_object.attachment_id
|
|
275
|
+
id: mediaObject.media_object.attachment_id,
|
|
276
|
+
uuid: mediaObject.media_object.uuid,
|
|
277
|
+
contextType: mediaObject.media_object.context_type
|
|
276
278
|
};
|
|
277
279
|
dispatch(removePlaceholdersFor(uploadedFile.name));
|
|
278
280
|
embedUploadResult(embedData, 'media');
|
|
@@ -138,11 +138,22 @@ describe('fileTypeUtils', () => {
|
|
|
138
138
|
it('uses attachment route if id is present', () => {
|
|
139
139
|
const file = {
|
|
140
140
|
id: '123',
|
|
141
|
-
type: 'video/mov'
|
|
141
|
+
type: 'video/mov',
|
|
142
|
+
uuid: 'abc'
|
|
142
143
|
};
|
|
143
144
|
const url = mediaPlayerURLFromFile(file);
|
|
144
145
|
expect(url).toBe('/media_attachments_iframe/123?type=video&embedded=true');
|
|
145
146
|
});
|
|
147
|
+
it('uses adds the uuid if the context is User', () => {
|
|
148
|
+
const file = {
|
|
149
|
+
id: '123',
|
|
150
|
+
type: 'video/mov',
|
|
151
|
+
contextType: 'User',
|
|
152
|
+
uuid: 'abc'
|
|
153
|
+
};
|
|
154
|
+
const url = mediaPlayerURLFromFile(file);
|
|
155
|
+
expect(url).toBe('/media_attachments_iframe/123?type=video&embedded=true&verifier=abc');
|
|
156
|
+
});
|
|
146
157
|
it('uses the file verifier if present', () => {
|
|
147
158
|
const file = {
|
|
148
159
|
id: '123',
|
|
@@ -150,7 +161,7 @@ describe('fileTypeUtils', () => {
|
|
|
150
161
|
url: 'host?verifier=something'
|
|
151
162
|
};
|
|
152
163
|
const url = mediaPlayerURLFromFile(file);
|
|
153
|
-
expect(url).toBe('/media_attachments_iframe/123?type=video&verifier=something
|
|
164
|
+
expect(url).toBe('/media_attachments_iframe/123?type=video&embedded=true&verifier=something');
|
|
154
165
|
});
|
|
155
166
|
it('uses media_object route if no attachmentId exists', () => {
|
|
156
167
|
const file = {
|