canvas_link_migrator 1.0.7 → 1.0.8

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e74a62a030858ee5785138c032c6a03e38f75d05acac287dbded691fa642c593
4
- data.tar.gz: d380a8f3b556d0da9d18e198483e48590e767b481415dd417d808da70d12f5fe
3
+ metadata.gz: a329fcce5ac60d34c29e9e09005e8bb5c6ced87ff0ca2b7529821ff70d280045
4
+ data.tar.gz: 4b05fe6dae29056eedba8384b00549942eb0d1f5dc72c2ec6310ea7b353e07af
5
5
  SHA512:
6
- metadata.gz: a8b6f64385cfa820b655f009a327bb207320ffb673ea4228b69f13584550b9da18cb5d79abdf0f3c7c861249ad2a49c20c5fcec0d9372d6299dd832dfe2e18f9
7
- data.tar.gz: 442098e04f4bd979f6c64eb6a83060cd8635f8c1cc7dc28e4688b0516cd9dc4215877352e9c3dde7c55798aa88059987ca1578bfb612e844222099940608ecde
6
+ metadata.gz: 37f76536082684d4f2c40c72a68f885921cd1a5570f1bfd5d0424b2a859933ead7dac479ae0c4fde8968d799eb3f233cf696602a5d4ac962f9e8257e80f781b8
7
+ data.tar.gz: eb9be3e0f256c16b6c4059f24b76d21d50d7c71ac40f73deb00ba737f2b32e3a4593ae86630ca5a364822839908328463741bafc42df27ddc95bfd3f2a97f01d
@@ -228,6 +228,9 @@ module CanvasLinkMigrator
228
228
  media_id = file.try(:media_object)&.media_id || file["media_entry_id"]
229
229
  node["data-media-id"] = media_id # safe to delete?
230
230
  media_attachment_iframe_url(file["id"], node["data-media-type"])
231
+ elsif rel_path&.match(/\/media_attachments_iframe\/\d+/)
232
+ # media attachment from another course or something
233
+ rel_path
231
234
  elsif node["data-media-id"].present?
232
235
  file = @migration_id_converter.lookup_attachment_by_media_id(node["data-media-id"])
233
236
  file ? media_attachment_iframe_url(file["id"], node["data-media-type"]) : nil
@@ -1,3 +1,3 @@
1
1
  module CanvasLinkMigrator
2
- VERSION = "1.0.7"
2
+ VERSION = "1.0.8"
3
3
  end
@@ -311,6 +311,16 @@ describe CanvasLinkMigrator::ImportedHtmlConverter do
311
311
  expect(@converter.convert_exported_html(test_string)).to eq([converted_string, nil])
312
312
  end
313
313
 
314
+ it "converts source tags to RCE media attachment iframes when link is an unknown media attachment reference (link from a public file in another course)" do
315
+ test_string = %(<video style="width: 400px; height: 225px; display: inline-block;" title="this is a media comment" data-media-type="video" allowfullscreen="allowfullscreen" allow="fullscreen" data-media-id="0_l4l5n0wt"><source src="/media_attachments_iframe/18?type=video" data-media-id="0_l4l5n0wt" data-media-type="video"></video>)
316
+ converted_string = %(<iframe style="width: 400px; height: 225px; display: inline-block;" title="this is a media comment" data-media-type="video" allowfullscreen="allowfullscreen" allow="fullscreen" data-media-id="0_l4l5n0wt" src="/media_attachments_iframe/18?type=video"></iframe>)
317
+ expect(@converter.convert_exported_html(test_string)).to eq([converted_string, nil])
318
+
319
+ test_string = %(<audio style="width: 400px; height: 225px; display: inline-block;" title="this is a media comment" data-media-type="audio" data-media-id="0_l4l5n0wu"><source src="/media_attachments_iframe/19?type=audio" data-media-id="0_l4l5n0wu" data-media-type="audio"></video>)
320
+ converted_string = %(<iframe style="width: 400px; height: 225px; display: inline-block;" title="this is a media comment" data-media-type="audio" data-media-id="0_l4l5n0wu" src="/media_attachments_iframe/19?type=audio"></iframe>)
321
+ expect(@converter.convert_exported_html(test_string)).to eq([converted_string, nil])
322
+ end
323
+
314
324
  it "converts course copy style media attachmet iframe links" do
315
325
  test_string = %(<video style="width: 400px; height: 225px; display: inline-block;" title="this is a media comment" data-media-type="video" allowfullscreen="allowfullscreen" allow="fullscreen" data-media-id="m-yodawg"><source src="$CANVAS_COURSE_REFERENCE$/file_ref/I?media_attachment=true&type=video" data-media-id="m-yodawg" data-media-type="video"></video>)
316
326
  converted_string = %(<iframe style="width: 400px; height: 225px; display: inline-block;" title="this is a media comment" data-media-type="video" allowfullscreen="allowfullscreen" allow="fullscreen" data-media-id="m-yodawg" src="/media_attachments_iframe/9?type=video&embedded=true"></iframe>)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: canvas_link_migrator
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.7
4
+ version: 1.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mysti Lilla
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2024-03-29 00:00:00.000000000 Z
14
+ date: 2024-04-02 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: activesupport