@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.
Files changed (175) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/es/rce/plugins/shared/fileTypeUtils.js +14 -6
  3. package/es/sidebar/actions/upload.js +3 -1
  4. package/lib/rce/plugins/shared/fileTypeUtils.js +14 -6
  5. package/lib/sidebar/actions/upload.js +3 -1
  6. package/lib/translated/ar/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
  7. package/lib/translated/ar/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
  8. package/lib/translated/ar/modules/sidebar/actions/upload.js +3 -1
  9. package/lib/translated/ca/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
  10. package/lib/translated/ca/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
  11. package/lib/translated/ca/modules/sidebar/actions/upload.js +3 -1
  12. package/lib/translated/cy/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
  13. package/lib/translated/cy/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
  14. package/lib/translated/cy/modules/sidebar/actions/upload.js +3 -1
  15. package/lib/translated/da/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
  16. package/lib/translated/da/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
  17. package/lib/translated/da/modules/sidebar/actions/upload.js +3 -1
  18. package/lib/translated/da-x-k12/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
  19. package/lib/translated/da-x-k12/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
  20. package/lib/translated/da-x-k12/modules/sidebar/actions/upload.js +3 -1
  21. package/lib/translated/de/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
  22. package/lib/translated/de/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
  23. package/lib/translated/de/modules/sidebar/actions/upload.js +3 -1
  24. package/lib/translated/el/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
  25. package/lib/translated/el/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
  26. package/lib/translated/el/modules/sidebar/actions/upload.js +3 -1
  27. package/lib/translated/en/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
  28. package/lib/translated/en/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
  29. package/lib/translated/en/modules/sidebar/actions/upload.js +3 -1
  30. package/lib/translated/en-AU-x-unimelb/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
  31. package/lib/translated/en-AU-x-unimelb/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
  32. package/lib/translated/en-AU-x-unimelb/modules/sidebar/actions/upload.js +3 -1
  33. package/lib/translated/en-GB-x-ukhe/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
  34. package/lib/translated/en-GB-x-ukhe/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
  35. package/lib/translated/en-GB-x-ukhe/modules/sidebar/actions/upload.js +3 -1
  36. package/lib/translated/en_AU/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
  37. package/lib/translated/en_AU/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
  38. package/lib/translated/en_AU/modules/sidebar/actions/upload.js +3 -1
  39. package/lib/translated/en_CA/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
  40. package/lib/translated/en_CA/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
  41. package/lib/translated/en_CA/modules/sidebar/actions/upload.js +3 -1
  42. package/lib/translated/en_CY/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
  43. package/lib/translated/en_CY/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
  44. package/lib/translated/en_CY/modules/sidebar/actions/upload.js +3 -1
  45. package/lib/translated/en_GB/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
  46. package/lib/translated/en_GB/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
  47. package/lib/translated/en_GB/modules/sidebar/actions/upload.js +3 -1
  48. package/lib/translated/es/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
  49. package/lib/translated/es/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
  50. package/lib/translated/es/modules/sidebar/actions/upload.js +3 -1
  51. package/lib/translated/es_ES/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
  52. package/lib/translated/es_ES/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
  53. package/lib/translated/es_ES/modules/sidebar/actions/upload.js +3 -1
  54. package/lib/translated/es_GT/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
  55. package/lib/translated/es_GT/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
  56. package/lib/translated/es_GT/modules/sidebar/actions/upload.js +3 -1
  57. package/lib/translated/fa_IR/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
  58. package/lib/translated/fa_IR/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
  59. package/lib/translated/fa_IR/modules/sidebar/actions/upload.js +3 -1
  60. package/lib/translated/fi/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
  61. package/lib/translated/fi/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
  62. package/lib/translated/fi/modules/sidebar/actions/upload.js +3 -1
  63. package/lib/translated/fr/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
  64. package/lib/translated/fr/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
  65. package/lib/translated/fr/modules/sidebar/actions/upload.js +3 -1
  66. package/lib/translated/fr_CA/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
  67. package/lib/translated/fr_CA/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
  68. package/lib/translated/fr_CA/modules/sidebar/actions/upload.js +3 -1
  69. package/lib/translated/he/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
  70. package/lib/translated/he/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
  71. package/lib/translated/he/modules/sidebar/actions/upload.js +3 -1
  72. package/lib/translated/ht/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
  73. package/lib/translated/ht/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
  74. package/lib/translated/ht/modules/sidebar/actions/upload.js +3 -1
  75. package/lib/translated/hu/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
  76. package/lib/translated/hu/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
  77. package/lib/translated/hu/modules/sidebar/actions/upload.js +3 -1
  78. package/lib/translated/hy/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
  79. package/lib/translated/hy/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
  80. package/lib/translated/hy/modules/sidebar/actions/upload.js +3 -1
  81. package/lib/translated/is/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
  82. package/lib/translated/is/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
  83. package/lib/translated/is/modules/sidebar/actions/upload.js +3 -1
  84. package/lib/translated/it/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
  85. package/lib/translated/it/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
  86. package/lib/translated/it/modules/sidebar/actions/upload.js +3 -1
  87. package/lib/translated/ja/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
  88. package/lib/translated/ja/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
  89. package/lib/translated/ja/modules/sidebar/actions/upload.js +3 -1
  90. package/lib/translated/ko/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
  91. package/lib/translated/ko/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
  92. package/lib/translated/ko/modules/sidebar/actions/upload.js +3 -1
  93. package/lib/translated/mi/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
  94. package/lib/translated/mi/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
  95. package/lib/translated/mi/modules/sidebar/actions/upload.js +3 -1
  96. package/lib/translated/ms/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
  97. package/lib/translated/ms/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
  98. package/lib/translated/ms/modules/sidebar/actions/upload.js +3 -1
  99. package/lib/translated/nb/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
  100. package/lib/translated/nb/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
  101. package/lib/translated/nb/modules/sidebar/actions/upload.js +3 -1
  102. package/lib/translated/nb-x-k12/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
  103. package/lib/translated/nb-x-k12/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
  104. package/lib/translated/nb-x-k12/modules/sidebar/actions/upload.js +3 -1
  105. package/lib/translated/nl/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
  106. package/lib/translated/nl/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
  107. package/lib/translated/nl/modules/sidebar/actions/upload.js +3 -1
  108. package/lib/translated/nn/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
  109. package/lib/translated/nn/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
  110. package/lib/translated/nn/modules/sidebar/actions/upload.js +3 -1
  111. package/lib/translated/pl/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
  112. package/lib/translated/pl/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
  113. package/lib/translated/pl/modules/sidebar/actions/upload.js +3 -1
  114. package/lib/translated/pt/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
  115. package/lib/translated/pt/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
  116. package/lib/translated/pt/modules/sidebar/actions/upload.js +3 -1
  117. package/lib/translated/pt_BR/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
  118. package/lib/translated/pt_BR/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
  119. package/lib/translated/pt_BR/modules/sidebar/actions/upload.js +3 -1
  120. package/lib/translated/ru/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
  121. package/lib/translated/ru/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
  122. package/lib/translated/ru/modules/sidebar/actions/upload.js +3 -1
  123. package/lib/translated/se/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
  124. package/lib/translated/se/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
  125. package/lib/translated/se/modules/sidebar/actions/upload.js +3 -1
  126. package/lib/translated/sl/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
  127. package/lib/translated/sl/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
  128. package/lib/translated/sl/modules/sidebar/actions/upload.js +3 -1
  129. package/lib/translated/sv/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
  130. package/lib/translated/sv/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
  131. package/lib/translated/sv/modules/sidebar/actions/upload.js +3 -1
  132. package/lib/translated/sv-x-k12/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
  133. package/lib/translated/sv-x-k12/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
  134. package/lib/translated/sv-x-k12/modules/sidebar/actions/upload.js +3 -1
  135. package/lib/translated/sv_SE/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
  136. package/lib/translated/sv_SE/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
  137. package/lib/translated/sv_SE/modules/sidebar/actions/upload.js +3 -1
  138. package/lib/translated/tg/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
  139. package/lib/translated/tg/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
  140. package/lib/translated/tg/modules/sidebar/actions/upload.js +3 -1
  141. package/lib/translated/th/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
  142. package/lib/translated/th/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
  143. package/lib/translated/th/modules/sidebar/actions/upload.js +3 -1
  144. package/lib/translated/th_TH/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
  145. package/lib/translated/th_TH/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
  146. package/lib/translated/th_TH/modules/sidebar/actions/upload.js +3 -1
  147. package/lib/translated/tr/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
  148. package/lib/translated/tr/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
  149. package/lib/translated/tr/modules/sidebar/actions/upload.js +3 -1
  150. package/lib/translated/uk_UA/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
  151. package/lib/translated/uk_UA/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
  152. package/lib/translated/uk_UA/modules/sidebar/actions/upload.js +3 -1
  153. package/lib/translated/vi/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
  154. package/lib/translated/vi/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
  155. package/lib/translated/vi/modules/sidebar/actions/upload.js +3 -1
  156. package/lib/translated/vi_VN/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
  157. package/lib/translated/vi_VN/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
  158. package/lib/translated/vi_VN/modules/sidebar/actions/upload.js +3 -1
  159. package/lib/translated/zh/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
  160. package/lib/translated/zh/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
  161. package/lib/translated/zh/modules/sidebar/actions/upload.js +3 -1
  162. package/lib/translated/zh-Hans/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
  163. package/lib/translated/zh-Hans/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
  164. package/lib/translated/zh-Hans/modules/sidebar/actions/upload.js +3 -1
  165. package/lib/translated/zh-Hant/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
  166. package/lib/translated/zh-Hant/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
  167. package/lib/translated/zh-Hant/modules/sidebar/actions/upload.js +3 -1
  168. package/lib/translated/zh_HK/modules/rce/plugins/shared/__tests__/fileTypeUtils.test.js +13 -2
  169. package/lib/translated/zh_HK/modules/rce/plugins/shared/fileTypeUtils.js +14 -6
  170. package/lib/translated/zh_HK/modules/sidebar/actions/upload.js +3 -1
  171. package/package.json +3 -2
  172. package/scripts/publishToNpm.sh +77 -0
  173. package/canvas/README.md +0 -84
  174. package/canvas/locales/en.json +0 -934
  175. 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&embedded=true');
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
- if (!file.url && !file.href) {
98
- return `/media_attachments_iframe/${file.id}?type=${type}&embedded=true`;
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
- const parsed_url = parse(file.url || file.href, true);
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&embedded=true');
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
- if (!file.url && !file.href) {
98
- return `/media_attachments_iframe/${file.id}?type=${type}&embedded=true`;
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
- const parsed_url = parse(file.url || file.href, true);
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&embedded=true');
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
- if (!file.url && !file.href) {
98
- return `/media_attachments_iframe/${file.id}?type=${type}&embedded=true`;
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
- const parsed_url = parse(file.url || file.href, true);
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&embedded=true');
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
- if (!file.url && !file.href) {
98
- return `/media_attachments_iframe/${file.id}?type=${type}&embedded=true`;
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
- const parsed_url = parse(file.url || file.href, true);
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&embedded=true');
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
- if (!file.url && !file.href) {
98
- return `/media_attachments_iframe/${file.id}?type=${type}&embedded=true`;
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
- const parsed_url = parse(file.url || file.href, true);
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&embedded=true');
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
- if (!file.url && !file.href) {
98
- return `/media_attachments_iframe/${file.id}?type=${type}&embedded=true`;
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
- const parsed_url = parse(file.url || file.href, true);
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&embedded=true');
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
- if (!file.url && !file.href) {
98
- return `/media_attachments_iframe/${file.id}?type=${type}&embedded=true`;
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
- const parsed_url = parse(file.url || file.href, true);
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&embedded=true');
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 = {