-
Notifications
You must be signed in to change notification settings - Fork 54
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
3937 - Links clicked in read views replace current tab #4262
3937 - Links clicked in read views replace current tab #4262
Conversation
my_display_html.strip, | ||
tags: SANITIZE_ALLOWED_TAGS, | ||
attributes: SANITIZE_ALLOWED_ATTRIBUTES | ||
).gsub('<br>','<br/>').gsub('<hr>','<hr/>') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems the sanitize function is stripping 'target' attributes on hrefs.
We can deal with this by whitelisting href and target, but passing in attributes
is restrictive rather than additive so I declared SANITIZE_ALLOWED_ATTRIBUTES above.
I may have missed some attributes there but I prioritized obvious ones and those that are explicitly used here in xml_to_html function.
NOTE:
Users will still have to add target="_blank" or "new" as done here:
https://www.fromthepage.com/nbwm/logbooks-and-journals/kwm-482/display/32946693
Let me know if this is okay
@@ -24,6 +26,11 @@ | |||
expect(xml_to_html(@xml_text, false, true)).to include("Faith<span class=\"line-break\"></span>fully") | |||
end | |||
|
|||
it 'returns a <a> tag with preserved href and target attributes' do | |||
expect(xml_to_html(@xml_text, true, true)).to include(@a_tag_with_attr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added specs to test new functionality
This is tested and can be merged as soon as it passes spec tests. |
No description provided.