Page MenuHomePhabricator

UploadWizard should validate bad user input inputted for location (Invalid LatLng object)
Closed, ResolvedPublic

Description

In https://commons.wikimedia.org/wiki/Special:UploadWizard go through the form. When prompted to add location information paste "52°13'04"N" into the latitude box and 21°01'24"E into the longitude box.

Screen Shot 2020-09-15 at 7.21.15 PM.png (1,230×702 px, 78 KB)

Click the pin

Screen Shot 2020-09-15 at 7.21.08 PM.png (2,324×1,282 px, 535 KB)

Expected:
The user is told their location is wrong

Actual:
A JS error is thrown and they can save their upload with bad geolocation data

Event Timeline

Jdlrobson renamed this task from UploadWizard should validate bad user input inputted for location to UploadWizard should validate bad user input inputted for location (Invalid LatLng object).Sep 16 2020, 9:46 PM

Hi, I would like to work on this issue

Hi @urvashi_g07, thanks for your interest and welcome to Wikimedia Phabricator! Feel free to do so. :)

The data being saved by the Upload Wizard is correct. It's just that the coordinates are not being normalized before being passed onto the map (which handled by the Kartographer extension).

This particular issue could be fixed by using the normalizeCoordinate() function to normalize the coordinates inside the onMapButtonClick() function in resources/details/uw.LocationDetailsWidget.js before passing the coordinates to the map setGeoJSON() function.

Screenshot from 2020-09-20 11-44-11.png (1,920×1,080 px, 403 KB)

I am encountering this issue while setting up the mediawiki repository. I am trying to install using docker installation procedure. Could you please tell me how to resolve this?

Hi @urvashi_g07, the last comment is off-topic here for this task (UploadWizard should validate bad user input inputted for location (Invalid LatLng object)). Please follow https://www.mediawiki.org/wiki/How_to_become_a_MediaWiki_hacker#Feedback,_questions_and_support - thanks! :)

Jdlrobson added a project: Maps.

This is now one of our top 10 JS production errors.

Change 642499 had a related patch set uploaded (by Sohom Datta; owner: Sohom Datta):
[mediawiki/extensions/UploadWizard@master] Convert latitude and longitude to proper format for location display

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

Change 642499 merged by jenkins-bot:
[mediawiki/extensions/UploadWizard@master] Convert latitude and longitude to proper format for location display

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

This one seems to be fixed on this particular page but note T269376