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

Fix: Packages\Url: Trim leading and trailing whitespaces #17320


Copy link

commented Sep 4, 2019


Trims the trailing and leading whitespaces in the url.

Fixes #17314.

How has this been tested?

  1. Create a new post.
  2. Insert a link with different url formats [ ] means whitespace.
  3. URLs above work as expected.

Types of changes

Bug fix.


  • My code is tested.
  • My code follows the WordPress code style.
@@ -360,6 +360,7 @@ export function removeQueryArgs( url, ...args ) {
* @return {string} The updated URL.
export function prependHTTP( url ) {
url = url.trim();

This comment has been minimized.

Copy link

gziolo Sep 4, 2019


Can you add unit test which covers it?

gziolo approved these changes Sep 4, 2019
Copy link

left a comment

Cool, thanks for including unit test. I will merge as soon as Travis CI confirms everything is valid.

@gziolo gziolo added this to the Gutenberg 6.5 milestone Sep 4, 2019
@gziolo gziolo merged commit e420ac2 into WordPress:master Sep 4, 2019
2 checks passed
2 checks passed
Travis CI - Pull Request Build Passed
dd32 pushed a commit to dd32/gutenberg that referenced this pull request Sep 27, 2019

* Fix: Packages\Url: Trim leading and trailing whitespaces

* Added unit tests for prependHTTP()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
3 participants
You can’t perform that action at this time.