Themes: improve search by trimming search string.

Fix an issue where searching installed themes for an empty string resulted in matching all themes.

Props afercia, desrosj, hesyifei, evalarumbe.
Fixes #39041.

Built from https://develop.svn.wordpress.org/trunk@45557


git-svn-id: http://core.svn.wordpress.org/trunk@45368 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Adam Silverstein 2019-06-20 14:15:53 +00:00
parent 89e7a75d96
commit bcc4ecb1f6
3 changed files with 5 additions and 2 deletions

View File

@ -180,6 +180,9 @@ themes.Collection = Backbone.Collection.extend({
// Start with a full collection
this.reset( themes.data.themes, { silent: true } );
// Trim the term
term = term.trim();
// Escape the term string for RegExp meta characters
term = term.replace( /[-\/\\^$*+?.()|[\]{}]/g, '\\$&' );

File diff suppressed because one or more lines are too long

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.3-alpha-45556';
$wp_version = '5.3-alpha-45557';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.