-
Notifications
You must be signed in to change notification settings - Fork 120
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
ErbRenderer should always return an HTML-safe String #2098
Merged
floehopper
merged 3 commits into
master
from
erb-renderer-should-always-return-html-safe-string
Nov 17, 2015
Merged
ErbRenderer should always return an HTML-safe String #2098
floehopper
merged 3 commits into
master
from
erb-renderer-should-always-return-html-safe-string
Nov 17, 2015
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Looks good to me. |
The fact that all content has been rendered by an instance of `ActionView::Base` means that it's safe to assume it's HTML-safe. `GovspeakPresenter#html` was already being marking its output as HTML-safe, but non-Govspeak content was not being marked as such. It would probably make sense to move the call to `String#html_safe` in `GovspeakPresenter#html` into `ErbRenderer#content_for`, but it's used in quite a few places and I want to reduce the scope of this change, so this is a good first step.
The main purpose of this is so that we can move the call to `String#chomp` into the `ErbRenderer` in order to mark the result as HTML-safe. In the long run, we could probably do without the call to `String#chomp` altogether, but the trouble is that it would cause changes to most/all of the regression test artefacts.
The page `title` and `h1` elements on all question pages is obtained from the start node title. This is now *correctly* being marked as HTML-safe when it comes back from the `ErbRenderer` and so the apostrophes are no longer being HTML-escaped. Note that @chrisroos & I were confused for a while because the old HTML-escaped behaviour was not visible in development or production. We're pretty sure this is because Slimmer uses Nokogiri to extract a fragment of HTML from the page and then re-inserts it in a new "layout". We suspect this process does some kind of normalisation which means the escaped apostrophes are unescaped.
8831576
to
8307d7f
Compare
I've rebased this against master and force-pushed in preparation for merging. |
floehopper
added a commit
that referenced
this pull request
Nov 17, 2015
…urn-html-safe-string ErbRenderer should always return an HTML-safe String
floehopper
added a commit
that referenced
this pull request
Nov 18, 2015
Since #2098 & #2112, apostrophes rendered via `SmartAnswer::ErbRenderer` have not been HTML-escaped. Now that we are rendering question content via this renderer, we need to update the regression test artefacts for question pages accordingly. I ran the following commands to do this: $ find test/artefacts/benefit-cap-calculator -name '*.html' | xargs sed -i .bak "s/'/'/g" $ git clean -fd test/artefacts/benefit-cap-calculator/**/*.bak
floehopper
added a commit
that referenced
this pull request
Nov 18, 2015
Since #2098 & #2112, apostrophes rendered via `SmartAnswer::ErbRenderer` have not been HTML-escaped. Now that we are rendering question content via this renderer, we need to update the regression test artefacts for question pages accordingly. I ran the following commands to do this: $ find test/artefacts/am-i-getting-minimum-wage -name '*.html' | xargs sed -i .bak "s/'/'/g" $ git clean -fd test/artefacts/am-i-getting-minimum-wage/**/*.bak
floehopper
added a commit
that referenced
this pull request
Nov 18, 2015
Since #2098 & #2112, apostrophes rendered via `SmartAnswer::ErbRenderer` have not been HTML-escaped. Now that we are rendering question content via this renderer, we need to update the regression test artefacts for question pages accordingly. I ran the following commands to do this: $ find test/artefacts/benefit-cap-calculator -name '*.html' | xargs sed -i .bak "s/'/'/g" $ git clean -fd test/artefacts/benefit-cap-calculator/**/*.bak
floehopper
added a commit
that referenced
this pull request
Nov 18, 2015
Since #2098 & #2112, apostrophes rendered via `SmartAnswer::ErbRenderer` have not been HTML-escaped. Now that we are rendering question content via this renderer, we need to update the regression test artefacts for question pages accordingly. I ran the following commands to do this: $ find test/artefacts/calculate-married-couples-allowance -name '*.html' | xargs sed -i .bak "s/'/'/g" $ git clean -fd test/artefacts/calculate-married-couples-allowance/**/*.bak
floehopper
added a commit
that referenced
this pull request
Nov 18, 2015
Since #2098 & #2112, apostrophes rendered via `SmartAnswer::ErbRenderer` have not been HTML-escaped. Now that we are rendering question content via this renderer, we need to update the regression test artefacts for question pages accordingly. I ran the following commands to do this: $ find test/artefacts/calculate-your-child-maintenance -name '*.html' | xargs sed -i .bak "s/'/'/g" $ git clean -fd test/artefacts/calculate-your-child-maintenance/**/*.bak
floehopper
added a commit
that referenced
this pull request
Nov 18, 2015
Since #2098 & #2112, apostrophes rendered via `SmartAnswer::ErbRenderer` have not been HTML-escaped. Now that we are rendering question content via this renderer, we need to update the regression test artefacts for question pages accordingly. I ran the following commands to do this: $ find test/artefacts/benefit-cap-calculator -name '*.html' | xargs sed -i .bak "s/'/'/g" $ git clean -fd test/artefacts/benefit-cap-calculator/**/*.bak
floehopper
added a commit
that referenced
this pull request
Nov 18, 2015
Since #2098 & #2112, apostrophes rendered via `SmartAnswer::ErbRenderer` have not been HTML-escaped. Now that we are rendering question content via this renderer, we need to update the regression test artefacts for question pages accordingly. I ran the following commands to do this: $ find test/artefacts/am-i-getting-minimum-wage -name '*.html' | xargs sed -i .bak "s/'/'/g" $ git clean -fd test/artefacts/am-i-getting-minimum-wage/**/*.bak
floehopper
added a commit
that referenced
this pull request
Nov 18, 2015
Since #2098 & #2112, apostrophes rendered via `SmartAnswer::ErbRenderer` have not been HTML-escaped. Now that we are rendering question content via this renderer, we need to update the regression test artefacts for question pages accordingly. I ran the following commands to do this: $ find test/artefacts/calculate-married-couples-allowance -name '*.html' | xargs sed -i .bak "s/'/'/g" $ git clean -fd test/artefacts/calculate-married-couples-allowance/**/*.bak
floehopper
added a commit
that referenced
this pull request
Nov 18, 2015
Since #2098 & #2112, apostrophes rendered via `SmartAnswer::ErbRenderer` have not been HTML-escaped. Now that we are rendering question content via this renderer, we need to update the regression test artefacts for question pages accordingly. I ran the following commands to do this: $ find test/artefacts/calculate-your-holiday-entitlement -name '*.html' | xargs sed -i .bak "s/'/'/g" $ git clean -fd test/artefacts/calculate-your-holiday-entitlement/**/*.bak
floehopper
added a commit
that referenced
this pull request
Nov 18, 2015
Since #2098 & #2112, apostrophes rendered via `SmartAnswer::ErbRenderer` have not been HTML-escaped. Now that we are rendering question content via this renderer, we need to update the regression test artefacts for question pages accordingly. I ran the following commands to do this: $ find test/artefacts/check-uk-visa -name '*.html' | xargs sed -i .bak "s/'/'/g" $ git clean -fd test/artefacts/check-uk-visa/**/*.bak
floehopper
added a commit
that referenced
this pull request
Nov 18, 2015
Since #2098 & #2112, apostrophes rendered via `SmartAnswer::ErbRenderer` have not been HTML-escaped. Now that we are rendering question content via this renderer, we need to update the regression test artefacts for question pages accordingly. I ran the following commands to do this: $ find test/artefacts/childcare-costs-for-tax-credits -name '*.html' | xargs sed -i .bak "s/'/'/g" $ git clean -fd test/artefacts/childcare-costs-for-tax-credits/**/*.bak
floehopper
added a commit
that referenced
this pull request
Nov 18, 2015
Since #2098 & #2112, apostrophes rendered via `SmartAnswer::ErbRenderer` have not been HTML-escaped. Now that we are rendering question content via this renderer, we need to update the regression test artefacts for question pages accordingly. I ran the following commands to do this: $ find test/artefacts/estimate-self-assessment-penalties -name '*.html' | xargs sed -i .bak "s/&/\&/g" $ git clean -fd test/artefacts/**/*.bak
floehopper
added a commit
that referenced
this pull request
Nov 18, 2015
Since #2098 & #2112, apostrophes rendered via `SmartAnswer::ErbRenderer` have not been HTML-escaped. Now that we are rendering question content via this renderer, we need to update the regression test artefacts for question pages accordingly. I ran the following commands to do this: $ find test/artefacts/inherits-someone-dies-without-will -name '*.html' | xargs sed -i .bak "s/'/'/g" $ git clean -fd test/artefacts/inherits-someone-dies-without-will/**/*.bak
floehopper
added a commit
that referenced
this pull request
Nov 18, 2015
Since #2098 & #2112, apostrophes rendered via `SmartAnswer::ErbRenderer` have not been HTML-escaped. Now that we are rendering question content via this renderer, we need to update the regression test artefacts for question pages accordingly. I ran the following commands to do this: $ find test/artefacts/inherits-someone-dies-without-will -name '*.html' | xargs sed -i .bak "s/'/'/g" $ git clean -fd test/artefacts/inherits-someone-dies-without-will/**/*.bak
floehopper
added a commit
that referenced
this pull request
Nov 19, 2015
Since #2098 & #2112, apostrophes rendered via `SmartAnswer::ErbRenderer` have not been HTML-escaped. Now that we are rendering question content via this renderer, we need to update the regression test artefacts for question pages accordingly. I ran the following commands to do this: $ find test/artefacts/pip-checker -name '*.html' -print0 | xargs -0 sed -i .bak "s/'/'/g" $ git clean -fd test/artefacts/pip-checker/**/*.bak
floehopper
added a commit
that referenced
this pull request
Nov 19, 2015
Since #2098 & #2112, apostrophes rendered via `SmartAnswer::ErbRenderer` have not been HTML-escaped. Now that we are rendering question content via this renderer, we need to update the regression test artefacts for question pages accordingly. I ran the following commands to do this: $ find test/artefacts/plan-adoption-leave -name '*.html' -print0 | xargs -0 sed -i .bak "s/'/'/g" $ git clean -fd test/artefacts/plan-adoption-leave/**/*.bak
floehopper
added a commit
that referenced
this pull request
Nov 19, 2015
Since #2098 & #2112, apostrophes rendered via `SmartAnswer::ErbRenderer` have not been HTML-escaped. Now that we are rendering question content via this renderer, we need to update the regression test artefacts for question pages accordingly. I ran the following commands to do this: $ find test/artefacts/simplified-expenses-checker -name '*.html' -print0 | xargs -0 sed -i .bak "s/'/'/g" $ git clean -fd test/artefacts/simplified-expenses-checker/**/*.bak
floehopper
added a commit
that referenced
this pull request
Nov 19, 2015
Since #2098 & #2112, apostrophes rendered via `SmartAnswer::ErbRenderer` have not been HTML-escaped. Now that we are rendering question content via this renderer, we need to update the regression test artefacts for question pages accordingly. I ran the following commands to do this: $ find test/artefacts/student-finance-calculator -name '*.html' -print0 | xargs -0 sed -i .bak "s/'/'/g" $ git clean -fd test/artefacts/student-finance-calculator/**/*.bak
floehopper
added a commit
that referenced
this pull request
Nov 19, 2015
Since #2098 & #2112, apostrophes rendered via `SmartAnswer::ErbRenderer` have not been HTML-escaped. Now that we are rendering question content via this renderer, we need to update the regression test artefacts for question pages accordingly. I ran the following commands to do this: $ find test/artefacts/calculate-your-child-maintenance -name '*.html' | xargs sed -i .bak "s/'/'/g" $ git clean -fd test/artefacts/calculate-your-child-maintenance/**/*.bak
floehopper
added a commit
that referenced
this pull request
Nov 19, 2015
Since #2098 & #2112, apostrophes rendered via `SmartAnswer::ErbRenderer` have not been HTML-escaped. Now that we are rendering question content via this renderer, we need to update the regression test artefacts for question pages accordingly. I ran the following commands to do this: $ find test/artefacts/calculate-your-holiday-entitlement -name '*.html' | xargs sed -i .bak "s/'/'/g" $ git clean -fd test/artefacts/calculate-your-holiday-entitlement/**/*.bak
floehopper
added a commit
that referenced
this pull request
Nov 19, 2015
Since #2098 & #2112, apostrophes rendered via `SmartAnswer::ErbRenderer` have not been HTML-escaped. Now that we are rendering question content via this renderer, we need to update the regression test artefacts for question pages accordingly. I ran the following commands to do this: $ find test/artefacts/check-uk-visa -name '*.html' | xargs sed -i .bak "s/'/'/g" $ git clean -fd test/artefacts/check-uk-visa/**/*.bak
floehopper
added a commit
that referenced
this pull request
Nov 19, 2015
Since #2098 & #2112, apostrophes rendered via `SmartAnswer::ErbRenderer` have not been HTML-escaped. Now that we are rendering question content via this renderer, we need to update the regression test artefacts for question pages accordingly. I ran the following commands to do this: $ find test/artefacts/childcare-costs-for-tax-credits -name '*.html' | xargs sed -i .bak "s/'/'/g" $ git clean -fd test/artefacts/childcare-costs-for-tax-credits/**/*.bak
floehopper
added a commit
that referenced
this pull request
Nov 19, 2015
Since #2098 & #2112, apostrophes rendered via `SmartAnswer::ErbRenderer` have not been HTML-escaped. Now that we are rendering question content via this renderer, we need to update the regression test artefacts for question pages accordingly. I ran the following commands to do this: $ find test/artefacts/uk-benefits-abroad -name '*.html' -print0 | xargs -0 sed -i .bak "s/'/'/g" $ git clean -fd test/artefacts/uk-benefits-abroad/**/*.bak
floehopper
added a commit
that referenced
this pull request
Nov 19, 2015
Since #2098 & #2112, apostrophes rendered via `SmartAnswer::ErbRenderer` have not been HTML-escaped. Now that we are rendering question content via this renderer, we need to update the regression test artefacts for question pages accordingly. I ran the following commands to do this: $ find test/artefacts/inherits-someone-dies-without-will -name '*.html' | xargs sed -i .bak "s/'/'/g" $ git clean -fd test/artefacts/inherits-someone-dies-without-will/**/*.bak
floehopper
added a commit
that referenced
this pull request
Nov 19, 2015
Since #2098 & #2112, apostrophes rendered via `SmartAnswer::ErbRenderer` have not been HTML-escaped. Now that we are rendering question content via this renderer, we need to update the regression test artefacts for question pages accordingly. I ran the following commands to do this: $ find test/artefacts/uk-benefits-abroad -name '*.html' -print0 | xargs -0 sed -i .bak "s/'/'/g" $ git clean -fd test/artefacts/uk-benefits-abroad/**/*.bak
floehopper
added a commit
that referenced
this pull request
Nov 19, 2015
Since #2098 & #2112, apostrophes rendered via `SmartAnswer::ErbRenderer` have not been HTML-escaped. Now that we are rendering question content via this renderer, we need to update the regression test artefacts for question pages accordingly. I ran the following commands to do this: $ find test/artefacts/pip-checker -name '*.html' -print0 | xargs -0 sed -i .bak "s/'/'/g" $ git clean -fd test/artefacts/pip-checker/**/*.bak
floehopper
added a commit
that referenced
this pull request
Nov 19, 2015
Since #2098 & #2112, apostrophes rendered via `SmartAnswer::ErbRenderer` have not been HTML-escaped. Now that we are rendering question content via this renderer, we need to update the regression test artefacts for question pages accordingly. I ran the following commands to do this: $ find test/artefacts/plan-adoption-leave -name '*.html' -print0 | xargs -0 sed -i .bak "s/'/'/g" $ git clean -fd test/artefacts/plan-adoption-leave/**/*.bak
floehopper
added a commit
that referenced
this pull request
Nov 19, 2015
Since #2098 & #2112, apostrophes rendered via `SmartAnswer::ErbRenderer` have not been HTML-escaped. Now that we are rendering question content via this renderer, we need to update the regression test artefacts for question pages accordingly. I ran the following commands to do this: $ find test/artefacts/simplified-expenses-checker -name '*.html' -print0 | xargs -0 sed -i .bak "s/'/'/g" $ git clean -fd test/artefacts/simplified-expenses-checker/**/*.bak
floehopper
added a commit
that referenced
this pull request
Nov 19, 2015
Since #2098 & #2112, apostrophes rendered via `SmartAnswer::ErbRenderer` have not been HTML-escaped. Now that we are rendering question content via this renderer, we need to update the regression test artefacts for question pages accordingly. I ran the following commands to do this: $ find test/artefacts/maternity-paternity-calculator -name '*.html' -print0 | xargs -0 sed -i .bak "s/'/'/g" $ git clean -fd test/artefacts/maternity-paternity-calculator/**/*.bak
floehopper
added a commit
that referenced
this pull request
Nov 19, 2015
Since #2098 & #2112, double-quotes rendered via `SmartAnswer::ErbRenderer` have not been HTML-escaped. Now that we are rendering question content via this renderer, we need to update the regression test artefacts for question pages accordingly. I ran the following commands to do this: $ find test/artefacts/maternity-paternity-calculator -name '*.html' -print0 | xargs -0 sed -i .bak "s/"/\"/g" $ git clean -fd test/artefacts/maternity-paternity-calculator/**/*.bak
floehopper
added a commit
that referenced
this pull request
Nov 19, 2015
Since #2098 & #2112, apostrophes rendered via `SmartAnswer::ErbRenderer` have not been HTML-escaped. Now that we are rendering question content via this renderer, we need to update the regression test artefacts for question pages accordingly. I ran the following commands to do this: $ find test/artefacts/student-finance-calculator -name '*.html' -print0 | xargs -0 sed -i .bak "s/'/'/g" $ git clean -fd test/artefacts/student-finance-calculator/**/*.bak
floehopper
added a commit
that referenced
this pull request
Nov 19, 2015
Since #2098 & #2112, apostrophes rendered via `SmartAnswer::ErbRenderer` have not been HTML-escaped. Now that we are rendering question content via this renderer, we need to update the regression test artefacts for question pages accordingly. I ran the following commands to do this: $ find test/artefacts/uk-benefits-abroad -name '*.html' -print0 | xargs -0 sed -i .bak "s/'/'/g" $ git clean -fd test/artefacts/uk-benefits-abroad/**/*.bak
floehopper
added a commit
that referenced
this pull request
Nov 19, 2015
Since #2098 & #2112, apostrophes rendered via `SmartAnswer::ErbRenderer` have not been HTML-escaped. Now that we are rendering question content via this renderer, we need to update the regression test artefacts for question pages accordingly. I ran the following commands to do this: $ find test/artefacts/maternity-paternity-calculator -name '*.html' -print0 | xargs -0 sed -i .bak "s/'/'/g" $ git clean -fd test/artefacts/maternity-paternity-calculator/**/*.bak
floehopper
added a commit
that referenced
this pull request
Nov 19, 2015
Since #2098 & #2112, double-quotes rendered via `SmartAnswer::ErbRenderer` have not been HTML-escaped. Now that we are rendering question content via this renderer, we need to update the regression test artefacts for question pages accordingly. I ran the following commands to do this: $ find test/artefacts/maternity-paternity-calculator -name '*.html' -print0 | xargs -0 sed -i .bak "s/"/\"/g" $ git clean -fd test/artefacts/maternity-paternity-calculator/**/*.bak
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Content that has already been rendered through
ErbRenderer
doesn't need to be HTML-escaped, becauseActionView::Base
will have already taken care of that. So we can mark content returned fromErbRenderer
as beinghtml_safe
.