Fix hash tile generation by checking the validity of URL input parameter and fallback to level, x, y variables.

This commit is contained in:
Aiosa 2022-08-21 10:09:36 +02:00
parent 298f069c7e
commit 61c77a3440
2 changed files with 7 additions and 9 deletions

View File

@ -688,11 +688,14 @@ $.TileSource.prototype = {
* @param {*} postData data the tile was fetched with (type depends on getTilePostData(..) return type) * @param {*} postData data the tile was fetched with (type depends on getTilePostData(..) return type)
*/ */
getTileHashKey: function(level, x, y, url, ajaxHeaders, postData) { getTileHashKey: function(level, x, y, url, ajaxHeaders, postData) {
if (ajaxHeaders) { function withHeaders(hash) {
return url + "+" + JSON.stringify(ajaxHeaders); return ajaxHeaders ? hash + "+" + JSON.stringify(ajaxHeaders) : hash;
} else {
return url;
} }
if (typeof url !== "string") {
return withHeaders(level + "/" + x + "_" + y);
}
return withHeaders(url);
}, },
/** /**

View File

@ -1398,11 +1398,6 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
options.ajaxHeaders = $.extend({}, this.ajaxHeaders, options.ajaxHeaders); options.ajaxHeaders = $.extend({}, this.ajaxHeaders, options.ajaxHeaders);
} }
if (!$.isFunction(options.tileSource.getTileHashKey)) {
//silently add custom implementation
options.tileSource.getTileHashKey = $.TileSource.prototype.getTileHashKey;
}
var myQueueItem = { var myQueueItem = {
options: options options: options
}; };