Page MenuHomePhabricator

Check if `asn` value exists before attempting to display it in IPInfo
Closed, ResolvedPublic

Description

The asn value is not guaranteed in the call response and if it comes back null, when we try to instantiate the tooltip in init.js it will throw an exception:

jQuery.Deferred exception: Cannot read property 'label' of null TypeError: Cannot read property 'label' of null

We can fix this by only instantiating the row if the asn exists or by setting the asn to '' if it doesn't exist

Event Timeline

Change 643137 had a related patch set uploaded (by STran; owner: STran):
[mediawiki/extensions/IPInfo@master] Check that asn value was returned before trying to show it

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

Change 643137 merged by jenkins-bot:
[mediawiki/extensions/IPInfo@master] Check that asn value was returned before trying to show it

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

dom_walden added subscribers: Prtksxna, dom_walden.

If MaxMind has no ASN data for an IP, the popup will only show the location and source.

E.g.:

noasn.png (66×326 px, 4 KB)

Putting into Design Review just to check that @Prtksxna is ok with this. Perhaps instead we want to explicitly state there is no ASN data.

This also fixes T267398, so I will close that.

Test environment: Vagrant MediaWiki 1.36.0-alpha (7410f4d), IP Info 0.0.0 (748907b).
Test browser: Firefox 78

Putting into Design Review just to check that @Prtksxna is ok with this. Perhaps instead we want to explicitly state there is no ASN data.

Thanks @dom_walden. I'll figure this one out along with T268297. Moving this to Done for now.