Skip to content

Commit

Permalink
refactor(geo): tile layer custom loader exception for data-urls
Browse files Browse the repository at this point in the history
  • Loading branch information
pelord committed May 16, 2024
1 parent e346b94 commit 4c27a5b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/geo/src/lib/layer/shared/layers/tile-layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ export class TileLayer extends Layer {
* @param url the url string or function to retrieve the data
*/
customLoader(tile, url: string, interceptor: AuthInterceptor) {
const dataRegex =
/data:(?<mime>[\w\/\-\.]+);(?<encoding>\w+),(?<data>.*)/gm;
if (dataRegex.test(url)) {
tile.getImage().src = url;
return;
}
const alteredUrlWithKeyAuth = interceptor.alterUrlWithKeyAuth(url);
let modifiedUrl = url;
if (alteredUrlWithKeyAuth) {
Expand Down

0 comments on commit 4c27a5b

Please sign in to comment.