Last modified: 2008-06-01 18:32:26 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 T13659, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 11659 - Gallery sometimes ignores image when using filename copied from URL
Gallery sometimes ignores image when using filename copied from URL
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
File management (Other open bugs)
1.12.x
All All
: Normal minor (vote)
: ---
Assigned To: Nobody - You can work on this!
http://commons.wikimedia.org/wiki/Use...
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-10-14 12:52 UTC by brianna.laugher
Modified: 2008-06-01 18:32 UTC (History)
1 user (show)

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


Attachments

Description brianna.laugher 2007-10-14 12:52:00 UTC
MediaWiki image title: Image:Nunâ island Upernavik district 2007-08-09 3.jpg
URL "title": Image:Nun%C3%A2_island_Upernavik_district_2007-08-09_3.jpg

If the URL title is used in <gallery> syntax, it gets completely ignored. Not even any text prints out. However  using it in a [[:link]] or just normally showing an image [[image:foo.jpg|thumb]] works fine.

This affects images with commas, single and double quotes and parentheses, as well as accented and non-Latin characters such as "â".

thanks.
Comment 1 brianna.laugher 2007-10-14 13:57:48 UTC
The problem is possibily in Parser.php function renderImageGallery around line 4459:

<code>
$tp = Title::newFromText( $matches[1] );
$nt =& $tp;
if( is_null( $nt ) ) {
# Bogus title. Ignore these so we don't bomb out later.
continue;
}
</code>

I'm not totally sure what constitutes a "bogus" title, since redlinked images appear in galleries... Ideally the image should show up, if not then it should be treated like a filename that doesn't exist, ie. the name just prints out as plain text.
Comment 2 Brion Vibber 2007-10-15 20:25:16 UTC
De-URL-escaping in wiki links is done in the parser itself as part of double-bracket handling. Title::newFromText() currently doesn't do de-URL-escaping. It's not 100% clear whether it should or not.

Note that URL-style percent codes are forbidden in raw titles to protect against titles which can't be consistently typed or cut-n-pasted -- that is, ensuring that 'Blah%20blah' can only mean 'Blah blah' and not a title actually called 'Blah%20blah'. So running a percent-encoded string through Title::newFromText() will come back with null, indicating an invalid title.
Comment 3 brianna.laugher 2007-10-16 00:07:52 UTC
OK, so if we assume for the moment that Title::newFromText() shouldn't do de-URL-escaping, how can we make URL-escaped titles behave the same as non-existent titles? ie. just print out the text.

My impression is that text just gets printed out when it fails this if statement: "if ( $title instanceof File )" in class ImageGallery functions add() and insert().

What if the is_null check in Parser.php is removed and functions add() and insert() are changed

old:

if ( $title instanceof File ) {

new:

if ( $title instanceof File && !is_null($title) ) {

Comment 4 Bryan Tong Minh 2008-04-29 21:51:20 UTC
Fixed in r33978.
Comment 5 Brion Vibber 2008-04-30 22:06:23 UTC
Reverted in r34064. The indiscriminate use of urldecode() here breaks images with a "+" character in their names.
Comment 6 Bryan Tong Minh 2008-04-30 22:10:01 UTC
Hm should be rawurldecode() then?
Comment 7 Bryan Tong Minh 2008-06-01 18:32:26 UTC
Fixed in r35683: Now first checks whether the link contains a %, similarly as done for normal links.

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


Navigation
Links