Project

General

Profile

Actions

Defect #44705

closed

SanitizationFilterTest#test_should_sanitize_html_strings fails with Nokogiri 1.19.5 and later

Defect #44705: SanitizationFilterTest#test_should_sanitize_html_strings fails with Nokogiri 1.19.5 and later

Added by Go MAEDA 22 days ago. Updated 22 days ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Gems support
Target version:
Resolution:
Fixed
Affected version:

Description

Starting with Nokogiri 1.19.5, the following test fails:

Failure:
Redmine::WikiFormatting::CommonMark::SanitizationFilterTest#test_should_sanitize_html_strings [test/unit/lib/redmine/wiki_formatting/common_mark/sanitization_filter_test.rb:156]:
--- expected
+++ actual
@@ -1 +1 @@
-"Lorem <a href=\"pants\" title=\"foo>ipsum <a href=\"><strong>dolor</strong></a> sit<br>amet " 
+"Lorem <a href=\"pants\" title=\"foo&gt;ipsum &lt;a href=\"><strong>dolor</strong></a> sit<br>amet " 

The failure occurs because updating Nokogiri to 1.19.5 or later changes the sanitized output. Since Nokogiri 1.19.5, < and > in attribute values are escaped as < and >, following whatwg/html#6362 (see sparklemotion/nokogiri#3741). This is an intended change in Nokogiri and does not affect how the HTML is displayed.

The attached patch updates the expected value in the test to match the new output. It changes test code only. Because the updated expected value does not match the output of Nokogiri 1.19.4 and earlier, the patch requires Nokogiri 1.19.5 or later and should be applied together with #44704, which updates the Nokogiri requirement.


Files


Related issues 1 (0 open — 1 closed)

Blocked by Redmine - Patch #44704: Update Nokogiri to 1.19.7 or laterClosedGo MAEDAActions

Updated by Go MAEDA 22 days ago Actions #1

  • Blocks Patch #44704: Update Nokogiri to 1.19.7 or later added

Updated by Go MAEDA 22 days ago Actions #2

  • Status changed from New to Resolved
  • Assignee set to Go MAEDA
  • Resolution set to Fixed

Committed the patch in r25417.

Updated by Go MAEDA 22 days ago Actions #3

  • Blocks deleted (Patch #44704: Update Nokogiri to 1.19.7 or later)

Updated by Go MAEDA 22 days ago Actions #4

  • Blocked by Patch #44704: Update Nokogiri to 1.19.7 or later added

Updated by Go MAEDA 22 days ago Actions #5

  • Status changed from Resolved to Closed
  • Target version changed from 6.1.7 to 7.0.4

Merged the fix into 7.0-stable in r25422.

Actions

Also available in: PDF Atom