Last modified: 2014-05-17 19:43:22 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 T37721, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 35721 - Moving files breaks hotlinks to original file asset
Moving files breaks hotlinks to original file asset
Status: NEW
Product: MediaWiki
Classification: Unclassified
File management (Other open bugs)
unspecified
All All
: Normal major (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-04-05 11:26 UTC by Rd232
Modified: 2014-05-17 19:43 UTC (History)
10 users (show)

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


Attachments

Description Rd232 2012-04-05 11:26:57 UTC
Hotlinking from external sites to Commons images is discouraged, but allowed (https://commons.wikimedia.org/wiki/Commons:REUSE#Hotlinking). Moving a file whilst creating a redirect unnecessarily breaks such hotlinks, because the upload.wikimedia.org URLs don't follow the redirect. 

Example: 
* Uploaded https://commons.wikimedia.org/wiki/File:Example-2.jpg
* Got the hotlink: https://upload.wikimedia.org/wikipedia/commons/8/8d/Example-2.jpg
* Moved the file, with redirect, to https://commons.wikimedia.org/wiki/File:Example-of-move.jpg
* Hotlink now gives a 404 page (and not even a particularly helpful one).
I've deleted this test, but the 404 page is exactly the same as for a deleted image.
Comment 1 Mark A. Hershberger 2012-04-05 18:30:07 UTC
Was wondering about this the other day.  Thanks!
Comment 2 Pine 2012-05-30 21:46:25 UTC
I see how this is a problem, but I'm not sure that "high major" is the right importance if hotlinking from external sites is discouraged.
Comment 3 Rainer Rillke @commons.wikimedia 2012-06-12 16:48:55 UTC
Also, please don't expose internals like the hashed-directory-structure in the URL. Provide a stable id for each file-revision and one for each file-"stack".
Comment 4 Bawolff (Brian Wolff) 2012-06-12 18:10:09 UTC
(In reply to comment #3)
> Also, please don't expose internals like the hashed-directory-structure in the
> URL. Provide a stable id for each file-revision and one for each file-"stack".

Note, the hashed directories are "stable" since they will only change if the filename changes. While they are kind of internal-ish, I imagine removing them would cause more disruption to hotlinkers then any benefit it would have. I suppose both could be kept working, but really doesn't seem like all that important of a thing.
Comment 5 Krinkle 2013-03-16 14:33:58 UTC
Perhaps this can be handled by the 404 handler for thumbnail generation?
Comment 6 Nemo 2013-06-11 10:46:38 UTC
Hotlinking is entirely legitimate; consensus has been often sought and never found to discourage it. Anyway, this can affect priority, but not severity, and this seems a major bug to me.

It is also for Wikimedia projects, by the way: e.g. http://fa.wikinews.org/?oldid=129251 produces on main page:
GET http://upload.wikimedia.org/wikipedia/commons/1/17/Wikinews_banner_22.png 404 (Not Found)

404 Not Found

The resource could not be found.

File not found: /v1/AUTH_43651b15-ed7a-40b6-b745-47666abf8dfe/wikipedia-commons-local-public.17/1/17/Wikinews_banner_22.png

Because [[commons:File:Wikinews_banner_22.png]] is a redirect.
Comment 7 Bawolff (Brian Wolff) 2013-06-11 13:44:00 UTC
(In reply to comment #6)
> Hotlinking is entirely legitimate; consensus has been often sought and never
> found to discourage it. Anyway, this can affect priority, but not severity,
> and
> this seems a major bug to me.
> 
> It is also for Wikimedia projects, by the way: e.g.
> http://fa.wikinews.org/?oldid=129251 produces on main page:
> GET http://upload.wikimedia.org/wikipedia/commons/1/17/Wikinews_banner_22.png
> 404 (Not Found)
> 
> 404 Not Found
> 
> The resource could not be found.
> 
> File not found:
> /v1/AUTH_43651b15-ed7a-40b6-b745-47666abf8dfe/wikipedia-commons-local-public.
> 17/1/17/Wikinews_banner_22.png
> 
> Because [[commons:File:Wikinews_banner_22.png]] is a redirect.

Note, that the sister project issue would also be fixed by bug 22390.

I agree this bug should be fixed for the hotlinkers (I would call it a normal priority issue).
Comment 8 Andre Klapper 2014-05-16 21:09:37 UTC
I don't consider this a "major loss of function in an important area". 
-> lowering severity.
Comment 9 Nemo 2014-05-16 21:21:47 UTC
(In reply to Andre Klapper from comment #8)
> I don't consider this a "major loss of function in an important area". 
> -> lowering severity.

http://www.w3.org/Provider/Style/URI.html + [[m:Don't delete redirects]] (specifically, Brion threatening deflag of those breaking image redirects) make me disagree.
Comment 10 Bawolff (Brian Wolff) 2014-05-17 19:43:22 UTC
Just to clarify something, this is fixed for thumbnails (e.g. https://upload.wikimedia.org/wikipedia/commons/thumb/2/25/Rouge.svg/200px-Rouge.svg.png redirects properly to https://upload.wikimedia.org/wikipedia/commons/thumb/2/25/Rouge.svg/200px-Red.svg.png). Its only the original  version of the file that breaks.

-----

Perhaps this could be fixed by, modifying upload-backend.inc.vcl (https://git.wikimedia.org/blob/operations%2Fpuppet.git/production/templates%2Fvarnish%2Fupload-backend.inc.vcl.erb) so that in the case an original file asset is requested, and if swift returns 404, try instead going to Special:FilePath, and if that returns a redirect, return that.

So for example, going to https://upload.wikimedia.org/wikipedia/commons/2/25/Rouge.svg would be something like:
*Ask swift, swift returns 404
*Go to https://commons.wikimedia.org/wiki/Special:Redirect/file/Rouge.svg
**If that returns a 302, and the 302 is not for the current url (to avoid loops) return that
**Otherwise return the 404 from swift (Bonus points for a more user-friendly 404 page)

[I don't know much about the bowels of varnish, so there may be things I'm missing here]

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


Navigation
Links