Project

General

Profile

Actions

Defect #44705

closed

SanitizationFilterTest#test_should_sanitize_html_strings fails with Nokogiri 1.19.5 and later

Added by Go MAEDA 1 day ago. Updated 1 day 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

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

Updated by Go MAEDA 1 day ago

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

Updated by Go MAEDA 1 day ago

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

Committed the patch in r25417.

Actions #3

Updated by Go MAEDA 1 day ago

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

Updated by Go MAEDA 1 day ago

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

Updated by Go MAEDA 1 day ago

  • 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: Atom PDF