diff --git a/src/dzitilesource.js b/src/dzitilesource.js index 6c95dbee..54b8cb68 100644 --- a/src/dzitilesource.js +++ b/src/dzitilesource.js @@ -140,7 +140,7 @@ $.extend( $.DziTileSource.prototype, $.TileSource.prototype, /** @lends OpenSead if (url && !options.tilesUrl) { options.tilesUrl = url.replace( - /([^\/]+?)(\.(dzi|xml|js))?\/?(\?.*)?$/, '$1_files/'); + /([^\/]+?)(\.(dzi|xml|js))?(\?[^\/]*)?\/?$/, '$1_files/'); if (url.search(/\.(dzi|xml|js)\?/) != -1) { options.queryParams = url.match(/\?.*/); diff --git a/test/modules/dzitilesource.js b/test/modules/dzitilesource.js index fe4677a0..e7eb2114 100644 --- a/test/modules/dzitilesource.js +++ b/test/modules/dzitilesource.js @@ -32,7 +32,10 @@ 'relative link should stay the same'); testImplicitTilesUrl( '/p/foo.dzi?a=1&b=2', '/p/foo_files/', - 'querystring in dzi url should be ignored'); + 'querystring in dzi url should be ignored after slashes'); + testImplicitTilesUrl( + '/iiipsrv?DeepZoom=/path/my.dzi', '/iiipsrv?DeepZoom=/path/my_files/', + 'querystring in dzi url should not be ignored before slashes'); }); }());