Skip to content

Commit

Permalink
Convert spaces in site URL path to hyphens.
Browse files Browse the repository at this point in the history
See #3218.
  • Loading branch information
boonebgorges committed Sep 12, 2023
1 parent c40c62b commit 532d838
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions wp-content/themes/openlab/js/group-create.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,12 @@ jQuery( document ).ready(
return;
}

// Convert uppercase to lowercase.
sitePathEl.value = sitePathEl.value.toLowerCase();

// Convert spaces to hyphens.
sitePathEl.value = sitePathEl.value.replace( /\s+/g, '-' );

// Check for valid characters.
if ( ! /^[a-z0-9-]+$/.test( sitePathEl.value ) ) {
setFormStatus( form, 'invalid', 'Site URL can only contain lowercase letters, numbers, and hyphens.', sitePathEl );
Expand Down

0 comments on commit 532d838

Please sign in to comment.