This repository was archived by the owner on Apr 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27.4k
fix(linky): handle the double quote character in email addresses #8964
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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.
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.
@lgalfaso - from what I read here - https://url.spec.whatwg.org/#url-parsing - we should be percent-encoding characters, rather than HTML encoding them. So the double quotes would be encoded as
%22
. Here is a link to the spec: http://tools.ietf.org/html/rfc3696#section-4.1I was wondering if we should go a step further and percent encode all the non-URL code points, which includes
"
.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.
But otherwise, I think this is a good compromise before we try improve our email parsing, which I now see if rather complicated if you allow comments and quoted sections...
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.
@petebacondarwin it is true that quotes need to be percent encoded, but if something reaches this point then we do not care what it is. We just have to put it inside an html attribute, where we need to encode the double quotes as this is a double-quotes attribute value http://www.w3.org/TR/html-markup/syntax.html#syntax-attr-double-quoted
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.
I agree that the regex that we use to detect emails and urls need some help, I am not trying to fix that, I am just trying to make
linky
generate valid html so angular does not break for people that use linky with user contentThere 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.
So I think what you are saying is that since
"Pete Bacon Darwin"@example.com
is a valid email (even with unencoded double quotes) then this ought to be allowed as a value to be put into an anchor element'shref
attribute, and that when serializing this attribute we should only be HTML encoding it.I am good with that. Let's go with this and then put out a
PR Plz
issue for better improving the email/URL identification in linky - perhaps looking at something like https://github.com/FogCreek/email-addressesI'll merge.