Fix link to media viewer with proper namespace

Use the canonical English namespace instead of a localized one.

Change-Id: I9fa1a2af1210c5a4a47792c3dc4616cb628cd806
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/826
Bug: 69956
This commit is contained in:
Mark Holmquist 2014-08-25 12:00:23 -07:00 committed by Gergő Tisza
parent 845e28e28e
commit 62bdbd57a6
2 changed files with 4 additions and 4 deletions

View file

@ -70,7 +70,7 @@
RP.createHash = function ( route ) {
if ( route instanceof mw.mmv.routing.ThumbnailRoute ) {
return this.applicationPrefix + '/' +
this.encodeRouteComponent( route.fileTitle.getPrefixedDb() );
this.encodeRouteComponent( 'File:' + route.fileTitle.getMain() );
} else if ( route instanceof mw.mmv.routing.MainFileRoute ) {
return this.applicationPrefix;
} else if ( route instanceof mw.mmv.routing.Route ) {

View file

@ -173,20 +173,20 @@
// mw.Title does not accept % in page names
this.sandbox.stub( mw, 'Title', function( name ) { return {
name: name,
getPrefixedDb: function() { return name; }
getMain: function() { return name.replace( /^File:/, '' ); }
}; } );
title = new mw.Title( 'File:%40.png' );
hash = router.createHash( new mw.mmv.routing.ThumbnailRoute( title ) );
window.location.hash = hash;
route = router.parseLocation( window.location );
assert.strictEqual( route.fileTitle.getPrefixedDb(), 'File:%40.png',
assert.strictEqual( route.fileTitle.getMain(), '%40.png',
'Reading location set via location.hash works' );
if ( window.history ) {
window.history.pushState( null, null, '#' + hash );
route = router.parseLocation( window.location );
assert.strictEqual( route.fileTitle.getPrefixedDb(), 'File:%40.png',
assert.strictEqual( route.fileTitle.getMain(), '%40.png',
'Reading location set via pushState() works' );
} else {
assert.ok( true, 'Skipped pushState() test, not supported on this browser' );