Make WordPress Core

Opened 6 years ago

Closed 5 years ago

#44808 closed defect (bug) (fixed)

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

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

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 6 years ago.
Add domain into trim function to trim spaces if added by mistake.
44808.2.patch (766 bytes) - added by dharmin16 5 years ago.
Trim domain name variable before validation

Download all attachments as: .zip

Change History (7)

@dharmin16
6 years ago

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

#1 @dharmin16
6 years ago

  • Severity changed from minor to normal

#2 @jeremyfelt
5 years ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to Future Release
  • Version changed from 4.9.8 to 3.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
5 years ago

Trim domain name variable before validation

#3 @dharmin16
5 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
5 years ago

  • Keywords has-patch added; needs-patch removed
  • Milestone changed from Future Release to 5.3
  • Owner set to jeremyfelt
  • Status changed from new to reviewing
  • Type changed from enhancement to defect (bug)

#5 @SergeyBiryukov
5 years ago

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

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.