Wrap the mw.Uri creation in a try-catch block

Bug: T261799
Change-Id: Ibaf027917f34d0591b7ebc669d9fbaff2f0bb442
This commit is contained in:
diwanshu885 2020-10-14 00:56:23 +05:30
parent 1d9557248e
commit 5271e7a08d
2 changed files with 8 additions and 4 deletions

View file

@ -916,8 +916,8 @@
function route( fileName ) {
var fileTitle;
comingFromHashChange = true;
fileName = decodeURIComponent( fileName );
try {
fileName = decodeURIComponent( fileName );
fileTitle = new mw.Title( fileName );
this.loadImageByTitle( fileTitle );
} catch ( err ) {

View file

@ -61,9 +61,13 @@
uri;
if ( this.imageQueryParameter ) {
uri = new mw.Uri( url );
extraParam[ this.imageQueryParameter ] = null;
url = uri.extend( extraParam ).toString();
try {
uri = new mw.Uri( url );
extraParam[ this.imageQueryParameter ] = null;
url = uri.extend( extraParam ).toString();
} catch ( error ) {
return $.Deferred().reject( error.message );
}
}
if ( !this.cache[ cacheKey ] ) {