Last modified: 2014-07-10 15:47:20 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 T34031, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 32031 - #ifexist does not say exist to existing redirects to file when using media pseudo-namespace
#ifexist does not say exist to existing redirects to file when using media ps...
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
File management (Other open bugs)
1.18.x
All All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
http://test.wikipedia.org/wiki/Ifexis...
: need-parsertest
Depends on: 32195
Blocks:
  Show dependency treegraph
 
Reported: 2011-10-29 08:40 UTC by db [inactive,noenotif]
Modified: 2014-07-10 15:47 UTC (History)
5 users (show)

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


Attachments

Description db [inactive,noenotif] 2011-10-29 08:40:49 UTC
See url, the ifexist call for the file redirect (with Media:) say "not exist", but the image exist under the redirect target.
Comment 1 Bawolff (Brian Wolff) 2011-10-29 19:04:09 UTC
Changing title of bug to reflect the issue is with media pseudo-namespace (to differentiate from redirects between different files)
Comment 2 Bawolff (Brian Wolff) 2011-10-29 19:10:27 UTC
Whoops, sorry. I totally misread what you wrote. Changing title back.


To clarify the issue is:

checking existence of Media:<some existing image, but possibly with no file description page, if for example from a foriegn image repo> returns true. but checking existence of Media:<some redirect to an image, possibly also on a foreign repo> returns false where we would expect it to return true. And checking existence of File:<something> just checks that the file description page exists.

So we would want Media:<some redirect to an image, possibly also on a foreign repo> to be considered existing.
Comment 3 Brion Vibber 2011-11-03 23:40:46 UTC
Looking at ParserFunctions it looks like it should work fine, as long as wfFindFile is returning a sensible File object for the target -- it's documented that you have to pass an option to disable redirects on the lookup, so *should* "just work".

I'm having trouble repro'ing locally as I'm not receiving imageinfo API data for the redirect on Commons.... so something else may be awry as well. :P
Comment 4 Brion Vibber 2011-11-03 23:44:18 UTC
bug 31849 covers some API issues which may be related; looking up the redir pages results in some missing data. Could be my ForeignAPIRepo problem, could also be related to the {{#ifexist}} itself.
Comment 5 Brion Vibber 2011-11-04 00:04:14 UTC
Ok on a local test I can confirm that wfFindFile and its cousins resolve redirects for File: title object but, for some reason, not for Media: title objects.

Unfortunately it looks like there are a *LOT* of entry points into File / FileRepo functions that take 'string or Title object' and are .... sloppy in validation.

Strings usually get Title'ized via Title::makeTitleSafe with an NS_FILE, but a Title object passed directly in doesn't get validated for namespace.

This probably leads to an NS_MEDIA Title object floating around, and eventually some lookup goes to that in the page table and fails.

There should probably be a consistent input validator used by all of these functions, which will do string -> Title conversions *and* validate the namespace. This could alias Media to File and drop any other namespaces as invalid for files...
Comment 6 db [inactive,noenotif] 2011-11-04 16:41:11 UTC
(In reply to comment #5)
> a Title object passed directly in doesn't get validated for namespace.
r76437 add a check on RepoGroup::findFile, which is used by wfFindFile and that is the main entry point.
Comment 7 Aaron Schulz 2011-11-08 19:05:10 UTC
What is needed here after r102073?
Comment 8 Aaron Schulz 2011-11-08 19:05:56 UTC
Also, might this be related to bug 31732?
Comment 9 Brion Vibber 2011-11-08 21:30:40 UTC
Could use a parser test case!
Comment 10 Aaron Schulz 2011-11-08 23:17:05 UTC
(In reply to comment #9)
> Could use a parser test case!

How do fake a file existing in the DB? I think a more  direct Media: w/ checkRedirect() test would work out better.
Comment 11 Gerrit Notification Bot 2014-05-22 22:29:25 UTC
Change 134963 had a related patch set uploaded by Brian Wolff:
Add unit tests for #ifexist in NS_MEDIA with file redirects

https://gerrit.wikimedia.org/r/134963
Comment 12 Gerrit Notification Bot 2014-07-10 14:02:41 UTC
Change 134963 merged by jenkins-bot:
Add unit tests for #ifexist in NS_MEDIA with file redirects

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

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


Navigation
Links