Wrap URL parameter decoding in try-catch for safety

This commit is contained in:
aplave 2019-12-22 10:32:17 -08:00
parent e46d7c64ae
commit f7f2f501f5

View File

@ -2586,8 +2586,13 @@ function OpenSeadragon( options ){
sep = part.indexOf( '=' ); sep = part.indexOf( '=' );
if ( sep > 0 ) { if ( sep > 0 ) {
URLPARAMS[ part.substring( 0, sep ) ] = var key = part.substring( 0, sep ),
decodeURIComponent( part.substring( sep + 1 ) ); value = part.substring( sep + 1 );
try {
URLPARAMS[ key ] = decodeURIComponent( value );
} catch (e) {
$.console.error( "Ignoring malformed URL parameter: %s=%s", key, value );
}
} }
} }