diff --git a/lib/cartodb/controllers/map.js b/lib/cartodb/controllers/map.js index 5ec2a0ef..34660ce0 100644 --- a/lib/cartodb/controllers/map.js +++ b/lib/cartodb/controllers/map.js @@ -314,6 +314,9 @@ MapController.prototype.augmentLayergroupData = function () { }; }; +function getTemplateUrl(url) { + return url.https || url.http; +} function getTilejson(tiles, grids) { const tilejson = { @@ -371,14 +374,14 @@ MapController.prototype.setTilejsonMetadataToLayergroup = function () { tilejson.vector = getTilejson( this.resourceLocator.getTileUrls(user, vectorResource) ); - url.vector = this.resourceLocator.getTemplateUrls(user, vectorResource); + url.vector = getTemplateUrl(this.resourceLocator.getTemplateUrls(user, vectorResource)); if (!isVectorOnlyMapConfig) { const rasterResource = `${layergroup.layergroupid}/{z}/{x}/{y}.png`; tilejson.raster = getTilejson( this.resourceLocator.getTileUrls(user, rasterResource) ); - url.raster = this.resourceLocator.getTemplateUrls(user, rasterResource); + url.raster = getTemplateUrl(this.resourceLocator.getTemplateUrls(user, rasterResource)); } } diff --git a/test/acceptance/tilejson.js b/test/acceptance/tilejson.js index 67b68d1c..0d3bc133 100644 --- a/test/acceptance/tilejson.js +++ b/test/acceptance/tilejson.js @@ -179,8 +179,8 @@ describe('tilejson', function() { const url = metadata.url; assert.deepEqual(Object.keys(url), ['vector']); - assert.ok(url.vector.http.urlTemplate); - assert.ok(url.vector.http.subdomains); + assert.ok(url.vector.urlTemplate); + assert.ok(url.vector.subdomains); testClient.drain(done); }); @@ -204,11 +204,11 @@ describe('tilejson', function() { const url = metadata.url; assert.deepEqual(Object.keys(url), ['vector', 'raster']); - assert.ok(url.vector.http.urlTemplate); - assert.ok(url.vector.http.subdomains); + assert.ok(url.vector.urlTemplate); + assert.ok(url.vector.subdomains); - assert.ok(url.raster.http.urlTemplate); - assert.ok(url.raster.http.subdomains); + assert.ok(url.raster.urlTemplate); + assert.ok(url.raster.subdomains); testClient.drain(done); });