Make WordPress Core

Opened 8 years ago

Closed 7 years ago

#44808 closed defect (bug) (fixed)

Creating subsite with un-trimmed space results in "Missing or invalid site address."

Reported by: aubreypwd Owned by: jeremyfelt
Priority: normal Milestone: 5.3
Component: Networks and Sites Version: 3.1
Severity: normal Keywords: has-patch
Cc: Focuses: multisite

Description

When adding a site:

http://aubrey.pw/d/2018/t96dsz13Kd.png

If the Site Address contains a space at the end (which is easily noticeable) it can result in "Missing or invalid site address.":

http://aubrey.pw/d/2018/b9zBWfACwV.png

We can improve this by sanitizing/trimming whitespace from the input.

Attachments (2)

44808.patch (518 bytes ) - added by dharmin16 8 years ago.
Add domain into trim function to trim spaces if added by mistake.
44808.2.patch (766 bytes ) - added by dharmin16 7 years ago.
Trim domain name variable before validation

Download all attachments as: .zip

Change History (7)

@dharmin16
8 years ago

Add domain into trim function to trim spaces if added by mistake.

#1 @dharmin16
8 years ago

  • Severity minornormal

#2 @jeremyfelt
7 years ago

  • Keywords needs-patch added
  • Milestone Awaiting ReviewFuture Release
  • Version 4.9.83.1

Good catch, it makes sense to trim this before validation.

@dharmin16 44808.patch looks like a good start, however the trim() should happen before validation rather than as a part of it. In the current form, the path is still saved with a space (e.g. /path-name /) in the database. This may mean using another variable to store $blog['domain'] during validation.

@dharmin16
7 years ago

Trim domain name variable before validation

#3 @dharmin16
7 years ago

Hi @jeremyfelt,

As per your advice, I've added changes. I've named the temporary variable as $raw_domain. If it's confusing, please share your suggestions.

Thanks

#4 @jeremyfelt
7 years ago

  • Keywords has-patch added; needs-patch removed
  • Milestone Future Release5.3
  • Owner set to jeremyfelt
  • Status newreviewing
  • Type enhancementdefect (bug)

#5 @SergeyBiryukov
7 years ago

  • Resolutionfixed
  • Status reviewingclosed

In 45804:

Networks and Sites: Trim site domain when creating a new site on Add New Site screen before further validation.

Props dharmin16, jeremyfelt, aubreypwd.
Fixes #44808.

Note: See TracTickets for help on using tickets.