mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-22 05:06:09 +03:00
added fix for supporting weird filenames that look like JSONs
This commit is contained in:
parent
b941864ac5
commit
2a251b219a
@ -2113,6 +2113,20 @@ function _getSafeElemSize (oElement) {
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @function
|
||||
* @private
|
||||
*/
|
||||
function _isJSON(str){
|
||||
try{
|
||||
JSON.parse(str);
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @function
|
||||
* @private
|
||||
@ -2127,7 +2141,7 @@ function getTileSourceImplementation( viewer, tileSource, imgOptions, successCal
|
||||
if ( tileSource.match( /^\s*<.*>\s*$/ ) ) {
|
||||
tileSource = $.parseXml( tileSource );
|
||||
//json should start with "{" or "[" and end with "}" or "]"
|
||||
} else if ( tileSource.match(/^\s*[\{\[].*[\}\]]\s*$/ ) ) {
|
||||
} else if ( _isJSON(tileSource) ) {
|
||||
tileSource = $.parseJSON(tileSource);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user