Project

General

Profile

Actions

Defect #44718

closed

Links to headings containing quotes break after upgrading to Rails 8.1.4.1

Defect #44718: Links to headings containing quotes break after upgrading to Rails 8.1.4.1

Added by Katsuya HIDAKA 21 days ago. Updated 21 days ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Text formatting
Target version:
Resolution:
Fixed
Affected version:

Description

After upgrading to Rails 8.1.4.1 #44711 , generated anchors for headings containing quotes change, breaking existing links. This affects both Textile and Markdown.

This is caused by a security fix in Rails' strip_tags, which now escapes single and double quotes in its output.
https://github.com/rails/rails/security/advisories/GHSA-rq8q-p985-fjq7

For example, the anchor for Bob's guide changes from Bobs-guide to Bob39s-guide. Wiki links such as [[#Bob's guide]] and [[#Bobs-guide]] no longer navigate to the heading. Previously saved URLs ending in #Bobs-guide are also affected.

Automatically generated TOC and paragraph-sign links still work because they use the new anchor names.


Files


Related issues 1 (0 open — 1 closed)

Related to Redmine - Patch #44711: Update Rails to 8.1.4.1ClosedGo MAEDAActions

Updated by Katsuya HIDAKA 21 days ago Actions #1

I'm attaching a patch to fix this issue.

  • Use the same sanitizer as strip_tags to remove HTML tags, and generate anchors before escaping quotes.
  • Preserve protection against HTML injection: sanitize_anchor_name removes unsafe characters from heading-derived anchor values, and html_escape_once escapes the text displayed in the TOC.

Tested with Chrome, Safari, and Firefox on macOS. The related tests pass.

Updated by Go MAEDA 21 days ago Actions #2

  • Category set to Text formatting
  • Status changed from New to Confirmed
  • Target version set to 7.0.4

Updated by Go MAEDA 21 days ago Actions #3

Updated by Go MAEDA 21 days ago Actions #4

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

Committed the fix in r25434. Thank you.

Updated by Go MAEDA 21 days ago Actions #5

  • Status changed from Resolved to Closed

Merged the fix into 7.0-stable branch in r25435.

Actions

Also available in: PDF Atom