Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#47888 closed defect (bug) (fixed)

Adding a custom link in menu via Customize doesn't trim whitespace.

Reported by: donmhico's profile donmhico Owned by: audrasjb's profile audrasjb
Milestone: 5.2.3 Priority: normal
Severity: normal Version:
Component: Menus Keywords: has-patch commit
Focuses: Cc:

Description

Steps to reproduce bug.

  1. Click "Customize" on any front-end page.
  2. Try to add / edit a Menu and add a Custom Link.

The following behaviour happens.

  1. If the URL has a whitespace in front. e.g. https://wp.org/
    • URL field box will have red border and the custom link won't be added.
  1. If the URL has a whitespace in the end. e.g. https://wp.org/
    • Custom link will be added but if the menu will have the link https://wp.org/%20

I think it would be best if the URL is trimmed before the checking of URL regex happens.

Attachments (2)

47888.diff (1.4 KB) - added by donmhico 5 years ago.
db82be8a10468c2f56bf04cad39c1f8c.gif (388.1 KB) - added by audrasjb 5 years ago.

Download all attachments as: .zip

Change History (13)

@donmhico
5 years ago

#2 @donmhico
5 years ago

  • Keywords has-patch added

#3 @audrasjb
5 years ago

  • Component changed from General to Menus
  • Keywords needs-patch added; has-patch removed
  • Milestone changed from Awaiting Review to 5.2.3
  • Owner set to audrasjb
  • Status changed from new to assigned

Moving to 5.2.3: we should handle this ticket alongside #47723

#4 @SergeyBiryukov
5 years ago

  • Keywords has-patch added; needs-patch removed
  • Owner changed from audrasjb to SergeyBiryukov
  • Status changed from assigned to reviewing

#5 @SergeyBiryukov
5 years ago

  • Owner changed from SergeyBiryukov to audrasjb

#6 @audrasjb
5 years ago

  • Status changed from reviewing to accepted

Thanks @donmhico
47888.diff works like a charm on my side (see screenshot above).
Good to go :)

#7 @donmhico
5 years ago

@audrasjb You're welcome. Awesome gif BTW :)

#8 @audrasjb
5 years ago

  • Keywords commit added

This ticket was mentioned in Slack in #core by marybaum. View the logs.


5 years ago

#10 @SergeyBiryukov
5 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 45869:

Customizer: Trim whitespace from custom link URLs.

This complements a similar fix for the Menus screen in [45655].

Props donmhico, audrasjb.
Fixes #47888. See #47723.

#11 @SergeyBiryukov
5 years ago

In 45870:

Customizer: Trim whitespace from custom link URLs.

This complements a similar fix for the Menus screen in [45655].

Props donmhico, audrasjb.
Merges [45869] to the 5.2 branch.
Fixes #47888. See #47723.

Note: See TracTickets for help on using tickets.