Skip to content

Check and encode requested tags on every weblog page - #271

Open
snoopdave wants to merge 1 commit into
roller-6.1.xfrom
page-tags-encoding
Open

snoopdave wants to merge 1 commit into
roller-6.1.xfrom
page-tags-encoding

Conversation

@snoopdave

Copy link
Copy Markdown
Contributor

A custom page reads tags= from the query string. Three rough edges:

  • With entry= also present, the tags weren't checked against the weblog, because the check sat in the last branch of the validation chain. They are now checked whenever they're given; unknown tags answer 404, as they already did without an entry.
  • #showAutodiscoveryLinks printed the tag names into the feed link titles as is. They're now HTML-encoded there, and in the Gaurav and Fauxcoly tags_index.vm pages.
  • The page cache keyed a custom page that names an entry by the entry alone, and left request tags out of custom-page keys. The key now includes the page name and the (sorted, encoded) tags.

Tests: AutodiscoveryLinksRenderingTest renders the real macro; WeblogPageCacheKeyTest covers the keys. Both fail on roller-6.1.x and pass here. No test covers the PageServlet change. mvn -pl app test: 503 tests, 0 failures.

Once this is merged, the same change goes to master for 7.0.0, where the Hyde, Terminal and PaperMod tag pages need the same encoding.

A custom page that is given tags= together with an entry now checks the
tags against the weblog, as it already did without an entry. Tag names are
HTML-encoded in the feed link titles of #showAutodiscoveryLinks and in the
Gaurav and Fauxcoly tag pages. The page cache key includes the page name
and the tags, so such pages get their own cache entries.

@mraible mraible 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.

LGTM. Tags are now checked whenever they're given, so an entry plus unknown tags answers 404. The cache key now includes the page name and the URL-encoded tags. I checked the rest of 6.1.x, and every other place that prints the tags already encodes them. Optional: a test for the PageServlet change, which the description says isn't covered.

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