Last modified: 2011-09-07 14:45:27 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T32789, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 30789 - Percent in filename breaks thumbnails
Percent in filename breaks thumbnails
Status: RESOLVED DUPLICATE of bug 26233
Product: MediaWiki
Classification: Unclassified
File management (Other open bugs)
unspecified
All All
: Unprioritized normal (vote)
: ---
Assigned To: Nobody - You can work on this!
: upstream
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-09-06 22:37 UTC by Jelle Zijlstra
Modified: 2011-09-07 14:45 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Jelle Zijlstra 2011-09-06 22:37:25 UTC
See https://secure.wikimedia.org/wikipedia/en/wiki/File:Ex_1%25_ample.jpg. Both of the thumbnails in the file history section do not show up. When I go to the URL of the first thumbnail (http://upload.wikimedia.org/wikipedia/en/thumb/d/db/Ex_1%25_ample.jpg/111px-Ex_1%25_ample.jpg) in my browser, I get the following error:

<blockquote>
Error generating thumbnail

Error creating thumbnail: convert: unable to open image `/mnt/thumbs/wikipedia/en/thumb/d/db/Ex_1%%_ample.jpg/111px-Ex_1%%_ample.jpg': @ error/blob.c/OpenBlob/2498.
</blockquote>

Something is wrong with URL decoding, causing the %25 in the URL to get converted to %% instead of %.

(This originally got reported on [[w:WP:VPT]] (https://secure.wikimedia.org/wikipedia/en/w/index.php?title=Wikipedia:Village_pump_%28technical%29&oldid=448818820#Broken_thumbnail); the problematic file was fixed by renaming it to a title that didn't contain the percent sign.)
Comment 1 Brion Vibber 2011-09-07 00:59:15 UTC
Ok, so the good news is the bug isn't in thumb-handler.php etc. :)
Seems odd...

With this original URL:

  http://upload.wikimedia.org/wikipedia/en/thumb/archive/d/db/20110906223017!Ex_1%25_ample.jpg/111px-Ex_1%25_ample.jpg

it should be getting run via the thumb-handler.php on the upload server's 404 handler:

  http://svn.wikimedia.org/viewvc/mediawiki/trunk/tools/upload-scripts/thumb-handler.php?view=markup

which should end up fetching something like:

  http://en.wikipedia.org/w/thumb.php?f=20110906223017!Ex_1%25_ample.jpg&width=111&archived=1

This gives the same error when we fetch it directly:

  Error generating thumbnail

  Error creating thumbnail: convert: unable to open image `/mnt/thumbs/wikipedia/en/thumb/archive/d/db/20110906223017!Ex_1%%_ample.jpg/111px-Ex_1%%_ample.jpg': @ error/blob.c/OpenBlob/2498.

Now, the '1%%' looks wrong -- it should be '1%' here.


So, the good news is:
* it's not in thumb-handler.php (whew!) since it happens to direct thumb.php calls

* it does the same for archived and current version files

And in fact I can reproduce it locally simply by uploading a local copy of 'Ex 1% ample.jpg' and trying to see the current-version page. This shows an error right there on the page.
Comment 2 Brion Vibber 2011-09-07 01:07:03 UTC
r65467:

	/**
	 * Escape a string for ImageMagick's output filename. See
	 * InterpretImageFilename() in magick/image.c.
	 */
	function escapeMagickOutput( $path, $scene = false ) {
		$path = str_replace( '%', '%%', $path );
		return $this->escapeMagickPath( $path, $scene );
	}

So... it seems to be doing this on purpose... perhaps that purpose has gone obsolete or something else is funky.
Comment 3 Brion Vibber 2011-09-07 01:12:54 UTC
That was added in as a fix for bug 23148 -- originally more simply and only on the comment field.

r65467 later applied the same replacement to other fields including the destination filename, and another special replacement for the input filename.

Possibly this is wrong for the output filename?
Comment 4 Brion Vibber 2011-09-07 01:31:24 UTC
Behavior seems to have changed -- if I compile ImageMagick 6.6.9 locally it goes ahead and processes the file, whereas the 6.6.2 that shipped with Ubuntu 11.04 complains about the %% form...

2011-01-10  6.6.7-1 Cristy  <quetzlzacatenango@image...>
  * Accept escaped % in output filename (reference
    http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=17810).

Bingo!
Comment 5 Brion Vibber 2011-09-07 01:42:05 UTC
I've filed an RT ticket internally to request that our deployed ImageMagick get updated: http://rt.wikimedia.org/Ticket/Display.html?id=1444
Comment 6 Jelle Zijlstra 2011-09-07 04:10:16 UTC
Thanks for the investigation and for finding the solution.

*** This bug has been marked as a duplicate of bug 26233 ***
Comment 7 Bryan Tong Minh 2011-09-07 07:52:16 UTC
Percents in file names are perhaps too funky too allow. There are so many things that can break with it; perhaps it is better to just disallow it totally.
Comment 8 Jelle Zijlstra 2011-09-07 14:45:27 UTC
That makes sense to me, but it would be problematic because there are actually quite a few files with percent signs in their filenames (e.g., http://commons.wikimedia.org/wiki/File:25%25.svg, http://commons.wikimedia.org/wiki/File:25%25.png). Those are either SVGs, which aren't affected by this bug, or PNGs so small that they don't get thumbnailed. I have no idea how many more there may be, since I can't find a way to search for them on-wiki (intitle:% doesn't work, and Googling inurl:%25 doesn't work either).

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links