diff options
| author | erdgeist <erdgeist@erdgeist.org> | 2026-08-09 23:31:35 +0200 |
|---|---|---|
| committer | erdgeist <erdgeist@erdgeist.org> | 2026-08-09 23:31:35 +0200 |
| commit | 5690cf4d4e05eafdfd2e270bbdf1a925114d0f76 (patch) | |
| tree | 1315dd1b91433f5287208a4f1b321dd722592966 /config | |
| parent | 4d8c7290adf8dd41677ccc44a5c5ffe5d1bed2f6 (diff) | |
Escape feed content with Builder rather than by hand
Builder escapes by default; the three feed templates no longer call
CGI.escapeHTML. This fixes two sites that never escaped at all: the tag
feed's externally supplied :tag segment, interpolated into its title, self
link and id, and dc:creator in the RDF template.
Subscribers see one difference: quotes and apostrophes arrive raw, which is
valid in element text.
config/initializers/xmlparser.rb, which redefined Builder::XmlBase#_escape
as the identity function, is gone. XML::Node#replace_with went with it, no
callers.
Diffstat (limited to 'config')
| -rw-r--r-- | config/initializers/xmlparser.rb | 19 |
1 files changed, 0 insertions, 19 deletions
diff --git a/config/initializers/xmlparser.rb b/config/initializers/xmlparser.rb deleted file mode 100644 index 1d5e06d9..00000000 --- a/config/initializers/xmlparser.rb +++ /dev/null | |||
| @@ -1,19 +0,0 @@ | |||
| 1 | class XML::Node | ||
| 2 | def replace_with(other) | ||
| 3 | self.next = other | ||
| 4 | remove! | ||
| 5 | end | ||
| 6 | end | ||
| 7 | |||
| 8 | # Builder 3.x escapes content by default. Override _escape to pass text | ||
| 9 | # through raw, preserving existing behaviour from the Rails 2 era. | ||
| 10 | # Note: require builder first to ensure XmlBase < BasicObject is already | ||
| 11 | # defined before we reopen it. | ||
| 12 | require 'builder' | ||
| 13 | module Builder | ||
| 14 | class XmlBase | ||
| 15 | def _escape(text) | ||
| 16 | text | ||
| 17 | end | ||
| 18 | end | ||
| 19 | end | ||
