canvas_link_migrator 1.0.12 → 1.0.13

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c7cbc11edecf38395bcf3dfda752a5a2946e9f691f86f95f35d80fe12a28f228
4
- data.tar.gz: d55a7c3509ce6da3b423e20b119f17ad5dbfd61f32d8f4f6a926ae0e84da343f
3
+ metadata.gz: 9b5936b2c0b84390589696838b2f7409d71467a11b20f81c63176e8e99a54caa
4
+ data.tar.gz: 49c4a0df338db02c8b658c49249f2fb8c3f9a75d60790f6fd72a405242682fca
5
5
  SHA512:
6
- metadata.gz: 8f54e3e63f1a47b50f0568bfcfce57f2b15c59a7097e7ea4fde9a89433554cba0a24bc60a854e267d2efab49c4cceec532d2c3a99e2b2b779cadbcc379a0c349
7
- data.tar.gz: 5b290e62a21a044efea17939e03ab3cd197e9acf7030fda2683b8f4c9a0033ef4ff72fa5f82b8dfe09affb1f3a86d8c4c55c21ef853768b93e16a6f19041a0ac
6
+ metadata.gz: c3c0f69c22fd75d7f783fa017993c7803f7504aa2e4b353917b33ec730a2cf0577e3f8941b58472a6ab694ab92bd667be12c5d65300119d7febea6cca0b9d45f
7
+ data.tar.gz: 3e6158123ea5ad27bd55033865474133d9bdc7e663006c05eb3d8efb76bf7fe49a6041e0b37d19d1d0ca606aba4bbb329caa9cd4b92e13db8b97fc65dace5d24
@@ -232,7 +232,7 @@ module CanvasLinkMigrator
232
232
  elsif url =~ %r{\$IMS(?:-|_)CC(?:-|_)FILEBASE\$/(.*)}
233
233
  rel_path = URI::DEFAULT_PARSER.unescape($1)
234
234
  if (attr == "href" && node["class"]&.include?("instructure_inline_media_comment")) ||
235
- (attr == "src" && ["iframe", "source"].include?(node.name))
235
+ (attr == "src" && ["iframe", "source"].include?(node.name) && (node["data-media-id"] || node["data-media-type"]))
236
236
  unresolved(:media_object, rel_path: rel_path)
237
237
  else
238
238
  unresolved(:file, rel_path: rel_path)
@@ -1,3 +1,3 @@
1
1
  module CanvasLinkMigrator
2
- VERSION = "1.0.12"
2
+ VERSION = "1.0.13"
3
3
  end
@@ -400,5 +400,16 @@ describe CanvasLinkMigrator::ImportedHtmlConverter do
400
400
  test_string = '<p><a href="#anchor_ref">ref</a></p>'
401
401
  expect(@converter.convert_exported_html(test_string)).to eq([test_string, nil])
402
402
  end
403
+
404
+ it "converts iframe srcs that point to non-media files" do
405
+ test_string = <<~HTML
406
+ <p><iframe style="width: 100%; height: 100vh; border: none;" src="$IMS-CC-FILEBASE$/subfolder/test.png?canvas_download=1"></iframe></p>
407
+ HTML
408
+ converted_string = <<~HTML
409
+ <p><iframe style="width: 100%; height: 100vh; border: none;" src="/courses/2/files/7/download?verifier=u7"></iframe></p>
410
+ HTML
411
+ html = @converter.convert_exported_html(test_string)
412
+ expect(html[0]).to eq converted_string
413
+ end
403
414
  end
404
415
  end
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.12
4
+ version: 1.0.13
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-06-14 00:00:00.000000000 Z
14
+ date: 2024-07-24 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: activesupport