-
Notifications
You must be signed in to change notification settings - Fork 385
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 validation errors for URLs with leading or trailing spaces #4166
Commits on Jan 23, 2020
-
Allow a URL to have a leading space without a validation error
As Weston found, something like: <a href=" https://wp.org"> would have a validation error.
Configuration menu - View commit details
-
Copy full SHA for fe3acd0 - Browse repository at this point
Copy the full SHA fe3acd0View commit details -
Replace 2 calls of trim() with longer regex in parse_protocol()
Those trim( $url ) calls were passed to parse_protocol(). So do something similar inside parse_protocol(), don't match leading space.
Configuration menu - View commit details
-
Copy full SHA for 9bd24e6 - Browse repository at this point
Copy the full SHA 9bd24e6View commit details -
As there's now a capturing group, remove lookahead
There is a matching group of ([^/]), so there probably isn't a need for the lookahead.
Configuration menu - View commit details
-
Copy full SHA for a01b51f - Browse repository at this point
Copy the full SHA a01b51fView commit details -
Revert change to regex, in favor of trimming before it's passed
Instead of changing this, simply trim() the URL before passing it to parse_protocol()
Configuration menu - View commit details
-
Copy full SHA for 761981e - Browse repository at this point
Copy the full SHA 761981eView commit details -
Move urldecode() lower in the function
As Weston mentioned, there might not be a need for it to run earlier.
Configuration menu - View commit details
-
Copy full SHA for bd4f45f - Browse repository at this point
Copy the full SHA bd4f45fView commit details -
Remove test case that is no longer handled
parse_protocol() no longer trims space on its own.
Configuration menu - View commit details
-
Copy full SHA for c703052 - Browse repository at this point
Copy the full SHA c703052View commit details
Commits on Jan 24, 2020
-
Add a new method to normalize URLs
Use this instead of trim() for the URLs in attributes.
Configuration menu - View commit details
-
Copy full SHA for 911602d - Browse repository at this point
Copy the full SHA 911602dView commit details -
Use suggested normalization, update tests
Use this from the AMP validator, instead of a simple regex, also use trim().
Configuration menu - View commit details
-
Copy full SHA for f193019 - Browse repository at this point
Copy the full SHA f193019View commit details -
Revert change in some tests, as they're not needed anymore
The behavior of the new parse_url_ method is changed, so these can change back.
Configuration menu - View commit details
-
Copy full SHA for 92bb4e6 - Browse repository at this point
Copy the full SHA 92bb4e6View commit details