Skip to content

Encode meta descriptions once, whatever the trust setting (6.1.x) - #273

Open
snoopdave wants to merge 1 commit into
roller-6.1.xfrom
meta-description-encoding-61x
Open

snoopdave wants to merge 1 commit into
roller-6.1.xfrom
meta-description-encoding-61x

Conversation

@snoopdave

Copy link
Copy Markdown
Contributor

Backport of #253 to 6.1.x: encode meta descriptions once, whatever the trust setting.

  • #showMetaDescription in weblog.vm and Gaurav's std_head.vm print the description with tags removed, entities decoded, then encoded.
  • Cherry-picked from f9b195e (Matt's commit) with -x; only CHANGES.md needed resolving, under a new 6.1.8 section.
  • MetaDescriptionEscapingTest comes with it and passes on 6.1.x. mvn -pl app test: 498 tests, 0 failures.

Master already has this change, so nothing goes back.

The templates now remove tags, decode entities and encode the result, so the attribute is encoded exactly once in both modes. MetaDescriptionEscapingTest renders both templates with stored and pre-encoded values; it fails on the old templates.

(cherry picked from commit f9b195e)

@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. The template and test changes are identical to f9b195e, and removeHTML, unescapeHTML and escapeHTML all exist in 6.1.x's UtilitiesModel.

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