Page MenuHomePhabricator

Can't edit really big galleries as the API request URL is too long
Closed, ResolvedPublic1 Estimated Story Points


User:Storkk reports:
I was trying to use VE to edit the image descriptions in a gallery on Commons. After clicking "edit", the gallery appears to highlight in light blue. Clicking anywhere pops up a small "Gallery" field with an "edit" box on the top right of the screen (as opposed to w:Wikipedia:VisualEditor/User_guide#Editing_media_galleries, which suggests it will be near the bottom). Clicking this (either the field or the "edit" button, or indeed anything else I could think to click on) makes the whole page "shimmer" whitish for about half a second, and nothing happens. Nothing like File:VisualEditor_-_Gallery3.png pops up, either near the Gallery edit box at the top right, or at the bottom, and the "edit" button stays "edit" rather than reading "done".
(the specific page I was trying to edit was commons:User:Storkk/poty16/cats)

Event Timeline

I made a few tests (there is an empty line at some point, and a picture is missing the File: prefix) but didn't find out much. I'm inclined to think it may be choking on too many items, because it works just fine if you leave 10 or 20 of them, for example.
I see several special characters in the file names, dunno if it matters.

VE tries to load image data for the gallery with the following API query:

Now you don't need to know much about programming to tell that this is a ridiculously long URL. Looks like it exceeds Chrome's length limit. But even when the browser can deal with it, the server responds with a "414 Request-URI Too Long" error. And even if that did not happen, the API will only accept 50 page titles in the 'titles' parameter (there are 158 here).

VE should make separate requests for the data, in chunks of 50 files, and possibly it should send the titles as POST body rather than GET query parameters (someone should look into browsers' and our servers' length limits to see if/when this is necessary).

Change 313605 had a related patch set uploaded (by Alex Monk):
Batch gallery imageinfo requests via ImageInfoCache subclass

Esanders renamed this task from Can't edit a gallery to Can't edit really big galleries.Oct 5 2016, 4:37 PM
Jdforrester-WMF set the point value for this task to 1.
Jdforrester-WMF renamed this task from Can't edit really big galleries to Can't edit really big galleries as the API request URL is too long.Nov 15 2016, 5:24 PM
Jdforrester-WMF assigned this task to AlexMonk-WMF.

Change 313605 merged by jenkins-bot:
Batch gallery imageinfo requests via ImageInfoCache subclass