canvas_link_migrator 1.0.16 → 1.0.17

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: efaf75cf3064504593f43e89db514210910841aed31d54f2d221d14966604f34
4
- data.tar.gz: bca0a633d4aa3fcf774ef6f953c007f0b8e71fc57bf89477e0567a66c9c8ba2c
3
+ metadata.gz: '08e4bb1b132305d9655e4f426f2685e6c524dff6f2e316ee4c32c4898e330e98'
4
+ data.tar.gz: b000b72459dd32746f8aa31d662df81e180aaff36fd461a88cd6c4d17bfed661
5
5
  SHA512:
6
- metadata.gz: beebade2ac325c6edce39afefe1a2d7016435cb94c18d911a7a1b5bbd6d53273d6d275eacc80f63d1c3be3f9d4dad8782934be1e10e0300ea6d0b8089fc6eaef
7
- data.tar.gz: 757708e37211c4d7a4359f813aa3e68f927112a3999d24e449adb3c3de35178a7504d9b4ded842c790fb4f22b906ee483e060b67ffaada4951a155711af87376
6
+ metadata.gz: e731f7af1980e3a1b731b138ba551b921776834f4fe237a005ecf737ddd270ad286d508482c3dd3050b0414c758f2b707d2084fa97c1714a697660e2f1e5dbff
7
+ data.tar.gz: 9a2100127f1aaf994360e18d6e0370cd67b60239caf9e1fab451bddfc1ae05a885a78abee63cf9d5f0c952b5add8789bf054f97667e0173617cdb7863009e3e7
@@ -81,7 +81,7 @@ module CanvasLinkMigrator
81
81
 
82
82
  def convert(html, item_type, mig_id, field, remove_outer_nodes_if_one_child: nil)
83
83
  mig_id = mig_id.to_s
84
- doc = Nokogiri::HTML5.fragment(html || "")
84
+ doc = Nokogiri::HTML5.fragment(html || "", max_tree_depth: 10_000)
85
85
 
86
86
  # Replace source tags with iframes
87
87
  doc.search("source[data-media-type],source[data-media-id]").each do |source|
@@ -1,3 +1,3 @@
1
1
  module CanvasLinkMigrator
2
- VERSION = "1.0.16"
2
+ VERSION = "1.0.17"
3
3
  end
@@ -69,5 +69,19 @@ describe CanvasLinkMigrator::LinkParser do
69
69
  doc = Nokogiri::HTML5.fragment(%Q(<a id="media_comment_m-4uoGqVdEqXhpqu2ZMytHSy9XMV73aQ7E" class="instructure_inline_media_comment" data-media_comment_type="video" data-alt=""></a>))
70
70
  expect{ parser.convert(doc.to_html, "type", "lookup_id", "field") }.not_to raise_error
71
71
  end
72
+
73
+ it "handles deeply nested html up to 10.000 levels" do
74
+ deeply_nested_html = "<div>" * 9999
75
+ deeply_nested_html += "<a target=\"_blank\"></a>"
76
+ deeply_nested_html += "</div>" * 9999
77
+ expect{ parser.convert(deeply_nested_html, "type", "lookup_id", "field") }.not_to raise_error
78
+ end
79
+
80
+ it "raises error when html is beyond 10.000 depth" do
81
+ deeply_nested_html = "<div>" * 10_000
82
+ deeply_nested_html += "<a target=\"_blank\"></a>"
83
+ deeply_nested_html += "</div>" * 10_000
84
+ expect{ parser.convert(deeply_nested_html, "type", "lookup_id", "field") }.to raise_error("Document tree depth limit exceeded")
85
+ end
72
86
  end
73
87
  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.16
4
+ version: 1.0.17
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: 2025-01-30 00:00:00.000000000 Z
14
+ date: 2025-03-05 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: activesupport