Page MenuHomePhabricator

[betalabs] MediaSearch - white spaces trigger TypeError: Cannot read property 'length' of null
Closed, ResolvedPublicBUG REPORT

Description

Steps to Reproduce:

  1. On Special:MediaSearch enter couple of white spaces into the search box
  2. Without even pressing Search button, the search field will display:

The Console error:
TypeError: Cannot read property 'length' of null
at a.getLookupResults

coming from

function Ue(e, t, n) {
                if (!z && !V || "undefined" == typeof console)
                    throw e;
                console.error(e)
            }

Note: the production wmf.3 does not display this issue - below is the screenshot with white spaces entered into the Search field - no visible reaction to users which is a correct behavior.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptAug 12 2020, 1:28 AM

Change 620108 had a related patch set uploaded (by Anne Tomasevich; owner: Anne Tomasevich):
[mediawiki/extensions/WikibaseMediaInfo@master] Trim whitespace from input before fetching autocomplete results

https://gerrit.wikimedia.org/r/620108

Change 620108 merged by jenkins-bot:
[mediawiki/extensions/WikibaseMediaInfo@master] Trim whitespace from input before fetching autocomplete results

https://gerrit.wikimedia.org/r/620108

@AnneT - it's still complaining on the following:

words = input.match(/[^\s]+/g).length;
                       inputRegex = new RegExp('^' + new Array(words + 1).join('[^\\s]+\\s*'), 'i');
                       this.doLookupRequest(input).then(function(results) {....
AnneT added a comment.Aug 20 2020, 1:19 AM

Hey @Etonkovidova, the fix for this just got merged today and it looks like it's not up on beta Commons yet

Hey @Etonkovidova, the fix for this just got merged today and it looks like it's not up on beta Commons yet

That what I was thinking (and waiting) - thx, @AnneT!

Etonkovidova closed this task as Resolved.Aug 26 2020, 9:42 PM