remove other token formats from imagery_used (#8976)

This commit is contained in:
Kyℓe Hensel
2022-02-12 08:00:05 +13:00
committed by GitHub
parent 6f7e78ca45
commit 72af994b2c
2 changed files with 7 additions and 2 deletions

View File

@@ -577,8 +577,9 @@ rendererBackgroundSource.Custom = function(template) {
}
// from wms/wmts api path parameters
cleaned = cleaned.replace(/token\/(\w+)/, 'token/{apikey}');
cleaned = cleaned
.replace(/token\/(\w+)/, 'token/{apikey}')
.replace(/key=(\w+)/, 'key={apikey}');
return 'Custom (' + cleaned + ' )';
};

View File

@@ -96,6 +96,10 @@ describe('iD.rendererBackgroundSource.Custom', function() {
var source = iD.rendererBackgroundSource.Custom('http://example.com/wms/v1/token/MYTOKEN/1.0.0/layer');
expect(source.imageryUsed()).to.eql('Custom (http://example.com/wms/v1/token/{apikey}/1.0.0/layer )');
});
it('sanitizes `key` in the URL path', function() {
var source = iD.rendererBackgroundSource.Custom('http://example.com/services;key=MYTOKEN/layer');
expect(source.imageryUsed()).to.eql('Custom (http://example.com/services;key={apikey}/layer )');
});
});
});