Last modified: 2014-09-02 03:26:53 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 T71469, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 69469 - Link to original file is not a link and can not be used as such
Link to original file is not a link and can not be used as such
Status: NEW
Product: MediaWiki extensions
Classification: Unclassified
MultimediaViewer (Other open bugs)
master
All All
: High major (vote)
: ---
Assigned To: Nobody - You can work on this!
:
: 68203 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-08-13 13:32 UTC by Thiemo Mättig
Modified: 2014-09-02 03:26 UTC (History)
6 users (show)

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


Attachments

Description Thiemo Mättig 2014-08-13 13:32:13 UTC
Steps to reproduce:
1. Open an image in the viewer.
2. Click the middle mouse button on "View original file" to open it in a new tab.

Nothing happens.

Or right click and try to open the link in a new tab. The function is not there because it's not a link. Why is that? I'm a developer and I really can't think of a reason to not make this a link.

Marking this as major because it breaks users expectations and UX flow and is one of many reasons why experienced users dislike the feature.
Comment 1 Tim Starling 2014-08-14 09:11:01 UTC
Thanks for the report, Thiemo. It looks easy enough to fix if you don't mind losing the click tracking. If you wanted to keep the click tracking, you would need to have the links go via a redirector, like external links in Google, Facebook, etc.
Comment 2 Thiemo Mättig 2014-08-14 09:31:46 UTC
(In reply to Tim Starling from comment #1)
> if you don't mind losing the click tracking.

You can have the exact same click handler on an <a> element. The <a href="..."> is for right click, middle click and such, the event handler does the same as it does now. You will not loose anything.
Comment 3 Derk-Jan Hartman 2014-08-14 12:40:51 UTC
We could click right click separately and then 'assume' that those would be the 'copy link' actions. Seems possible to me. I'm a fan of using <button> and <a> where ever we should.
Comment 4 Tim Starling 2014-08-14 13:17:03 UTC
(In reply to Thiemo Mättig from comment #2)
> You can have the exact same click handler on an <a> element. The <a
> href="..."> is for right click, middle click and such, the event handler
> does the same as it does now. You will not loose anything.

Navigating away from a page causes XHR requests to be aborted. So if the user left-clicks on the link, and you send a clicktrack request to the server and return true from the event handler, the clicktrack request will be immediately aborted when the browser navigates to the href target. The current behaviour is to wait for the clicktrack request to complete and then to change the location in the current window.

Note that we only track 1 in every 10,000 clicks at the moment. I would question whether the data is valuable enough to justify the drawbacks of either clicktracking method.
Comment 5 Tisza Gergő 2014-08-14 13:21:46 UTC
*** Bug 68203 has been marked as a duplicate of this bug. ***
Comment 6 Tisza Gergő 2014-08-14 13:45:54 UTC
There is no difference in click tracking between an <a> and a <span> with a click handler. Either way you can choose to delay navigation (which degrades user experience) or risk loosing the log event. (This is bug 42815, by the way. See also bug 44480.)

The problem is that the thumbnail might be available sooner than the link to the full image; in such a case, we delay the handling of the click until the imageinfo API request returns. There is no way to delay a middle/right click. As mentioned in bug 68203, the alternative would be to not show the icon until the data is present; that looks somewhat ugly but on the whole probably the better solution.

We could also try to guess the URL of the full image from the thumbnail URL, instead of relying on the API; we already have code for that, but so far we only used it in situations when a 404 can be caught and recovered from (i.e. to fetch the thumbnails displayed by MediaViewer). In theory, reconstructing the original file URL is really simple; still, it's a bit scary to do that when we have no way to detect that we might be sending the user to an error page.
Comment 7 Tim Starling 2014-08-14 14:17:26 UTC
It would be possible to reconstruct the source URL on the client side, but please be careful of abbrvThreshold, which is used on WMF. The source filename is only available in the thumbnail directory, not in the part of the thumbnail filename before the hyphen.

You should respect the repo's zone URL rather than assuming source files and thumbnails will be on the same server.

If thumbScriptUrl is used, it is somewhat more complicated, since an MD5 hash would have to be done on the client side. This is used on private WMF wikis, such as office.wikimedia.org.

An alternative would be to have the parser serialize the image data and embed it in the page for MMV to use. The parser loads all image information already, so having MMV load it as well is a bit redundant.
Comment 8 Tisza Gergő 2014-08-14 18:42:24 UTC
The code to guess an image URL from another one is at https://github.com/wikimedia/mediawiki-extensions-MultimediaViewer/blob/master/resources/mmv/provider/mmv.provider.GuessedThumbnailInfo.js#L259

It is not affected by abbreviated file names (we have a unit test for that). It does not respect zone URLs since those are not available without an API request, and the goal of URL guessing is to be able to load the image immediately. We could load the repo information via ResourceLoader, since it basically never changes; still, that's a minor issue, given that WMF servers are not affected, and on other servers URL guessing is disabled by default due to various other problems (image_auth.php, reverse proxies, lack of a 404 handler). I have opened bug 69558 for that.

(In reply to Tim Starling from comment #7)
> An alternative would be to have the parser serialize the image data and
> embed it in the page for MMV to use. The parser loads all image information
> already, so having MMV load it as well is a bit redundant.

We already do this for image dimensions because not having those really degrades user experience. bug 67302 comment #4 suggests that's not a future-compatible thing to do and should be avoided whenever possible.
Comment 9 Tisza Gergő 2014-08-14 18:47:45 UTC
Proposal:
* change the original file button to a proper link
* change the original file button to only appear when the URL becomes available
* when $wgUseThumbnailGuessing is true, use thumbnail guessing to ensure the URL is available immediately. That should be safe on WMF servers, and should be safe everywhere once bug 69558 is fixed.
Comment 10 Tim Starling 2014-09-02 03:26:53 UTC
(In reply to Tisza Gergő from comment #8)
> (In reply to Tim Starling from comment #7)
> > An alternative would be to have the parser serialize the image data and
> > embed it in the page for MMV to use. The parser loads all image information
> > already, so having MMV load it as well is a bit redundant.
> 
> We already do this for image dimensions because not having those really
> degrades user experience. bug 67302 comment #4 suggests that's not a
> future-compatible thing to do and should be avoided whenever possible.

I wouldn't recommend putting metadata in the content HTML, I would put it in JavaScript, like what I did in Scribunto to display error backtraces.

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


Navigation
Links