Merge pull request #1189 from lastlegion/master

[FIX #1188] added fix for supporting weird filenames that look like JSONs
This commit is contained in:
Ian Gilman 2017-05-11 10:01:07 -07:00 committed by GitHub
commit e55c5beb1c
2 changed files with 12 additions and 2 deletions

View File

@ -649,7 +649,11 @@ function processResponse( xhr ){
data = xhr.responseText;
}
}else if( responseText.match(/\s*[\{\[].*/) ){
data = $.parseJSON(responseText);
try{
data = $.parseJSON(responseText);
} catch(e){
data = responseText;
}
}else{
data = responseText;
}

View File

@ -2136,6 +2136,7 @@ function _getSafeElemSize (oElement) {
);
}
/**
* @function
* @private
@ -2151,7 +2152,12 @@ function getTileSourceImplementation( viewer, tileSource, imgOptions, successCal
tileSource = $.parseXml( tileSource );
//json should start with "{" or "[" and end with "}" or "]"
} else if ( tileSource.match(/^\s*[\{\[].*[\}\]]\s*$/ ) ) {
tileSource = $.parseJSON(tileSource);
try {
var tileSourceJ = $.parseJSON(tileSource);
tileSource = tileSourceJ;
} catch (e) {
//tileSource = tileSource;
}
}
}