Skip to content

Show comment and media file authors once-escaped in feeds and keep existing rel values in addNofollow - #347

Merged
mraible merged 3 commits into
roller-6.1.xfrom
feed-authors-and-nofollow-6.1.x
Nov 20, 2026
Merged

mraible merged 3 commits into
roller-6.1.xfrom
feed-authors-and-nofollow-6.1.x

Conversation

@mraible

@mraible mraible commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Follows up #330 from review, with the same change as the new commit on #318.

  • The comment feed macros and the media file feed now turn author names back into text with unescapeHTML before XML-escaping them, as the entry author macros do, so a name like A & B no longer shows as A & B in feed readers.
  • Utilities.addNofollow adds nofollow to a link's existing rel value instead of adding a second rel attribute, and a > inside a quoted attribute value no longer ends the link early.

Tests: FeedAuthorEscapingTest covers the Atom and RSS comment feeds and the media file feed, and UtilitiesTest has new addNofollow cases. The linear-time test now allows 2 seconds so it doesn't fail on slow build machines.

A further review pass added these fixes:

  • A comment saved without a name, or a media file whose creator can't be found, has an empty author in the feeds instead of printing the template expression.
  • addNofollow adds nofollow to links with a quote inside an unquoted attribute value or a quote that never closes, and to the links after them.

…isting rel values in addNofollow

The comment feed macros and the media file feed now turn author names back into text with unescapeHTML before XML-escaping them, as the entry author macros do, so a name like "A & B" no longer shows as "A & B" in feed readers. FeedAuthorEscapingTest covers the Atom and RSS comment feeds and the media file feed.

Utilities.addNofollow adds nofollow to a link's existing rel value instead of adding a second rel attribute, and a ">" inside a quoted attribute value no longer ends the link early. The linear-time test now allows 2 seconds so it doesn't fail on slow build machines.
@mraible
mraible requested a review from snoopdave November 18, 2026 04:16

@snoopdave snoopdave left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐞Codex Issue: 1 important inline finding on the current head.

addNofollow looked for rel= anywhere in the tag, so a link like <a href="/x" title='foo rel=external' rel="noopener"> had nofollow added to the title text while its real rel stayed followable. It now walks the tag's attributes while tracking quotes, the same way findTagEnd finds the end of the tag, and changes only a real rel attribute. A rel with no value gets rel="nofollow".
…low on links with odd quoting

A comment saved without a name, or a media file whose creator can't be found, made the comment and media file feeds print the template expression itself as the author, because unescapeHTML passed null through and Velocity prints a null reference as its source text. The template unescapeHTML helper now returns an empty string for null, as removeHTML does, so the author element is empty again.

addNofollow treated a quote anywhere after an equals sign as the start of a quoted value, so a quote inside an unquoted value could hide the end of the tag and leave that link and the next one without nofollow. A quote now only opens a value as its first character. When a quote never closes, the link ends at the next > as it did before the quote-aware scan, so later links still get nofollow, and a rel value with no closing quote gets one so the output stays well formed.

@snoopdave snoopdave left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review of c262a6233: Comment and media file authors in the feeds are unescaped and then XML-escaped once, matching the entry author macros, and addNofollow now extends an existing rel value and skips > inside quoted values. The attribute walk always advances, so it cannot loop, and the new tests cover the rel and quoting cases.

No new issues found.

@mraible
mraible merged commit 6654f50 into roller-6.1.x Nov 20, 2026
7 checks passed
@mraible
mraible deleted the feed-authors-and-nofollow-6.1.x branch November 20, 2026 00:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants