Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent jinja2 from escaping HTML markup in collection metadata #747

Merged
merged 1 commit into from
Aug 3, 2022

Conversation

tw4l
Copy link
Member

@tw4l tw4l commented Jul 29, 2022

Description

This PR adds jinja2 safe filters to metadata values and an {% autoescape false %} block to the collection title in the search template to prevent HTML markup in collection metadata from being escaped.

Motivation and Context

Connected to #727

This fixes a regression in more recent versions of pywb which was reported by users.

Screenshots (if appropriate):

Before

(copied from linked issue)

image

After

Screen Shot 2022-07-29 at 12 00 10 AM

Types of changes

  • Replay fix (fixes a replay specific issue)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added or updated tests to cover my changes.
  • All new and existing tests passed.

@ikreymer ikreymer changed the base branch from 2.7.0-beta to main August 2, 2022 23:53
@ikreymer ikreymer changed the base branch from main to 2.7.0-beta August 2, 2022 23:54
@ikreymer
Copy link
Member

ikreymer commented Aug 2, 2022

@tw4l looks good, yeah I think this started happening with autoescape being defaulted to true..
Since this isn't tied to 2.7.0, mind rebasing this off main, and then we can just merge it in separately

@tw4l tw4l force-pushed the dev/issue-727-escape-metadata branch from 658a05e to 7ab678f Compare August 3, 2022 00:58
@tw4l tw4l changed the base branch from 2.7.0-beta to main August 3, 2022 00:58
@tw4l
Copy link
Member Author

tw4l commented Aug 3, 2022

@ikreymer no problem! this is now rebased and ready to merge

@tw4l tw4l force-pushed the dev/issue-727-escape-metadata branch from 7ab678f to dc0c02e Compare August 3, 2022 01:19
@tw4l
Copy link
Member Author

tw4l commented Aug 3, 2022

I hadn't noticed there was a new commit on main upstream - should be good now :)

@ikreymer ikreymer merged commit 12a9e32 into webrecorder:main Aug 3, 2022
@ArtHoff
Copy link

ArtHoff commented Apr 4, 2023

Hi,
Thank you for addressing this issue, however there is still an issue with the HTML rewrite.
On the home page the first URL is clickable, but the one in the comment is displayed as HTML.

I expect to see:
image

But instead it shows:
image

Thanks for looking into this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants