Avoid custom headers to be undefined
This commit is contained in:
@@ -353,7 +353,9 @@ function incrementMapViews ({ metadataBackend }) {
|
||||
|
||||
const statTag = mapConfig.obj().stat_tag;
|
||||
|
||||
res.set('Carto-Stat-Tag', `${statTag}`);
|
||||
if (statTag) {
|
||||
res.set('Carto-Stat-Tag', `${statTag}`);
|
||||
}
|
||||
|
||||
metadataBackend.incMapviewCount(user, statTag, (err) => {
|
||||
if (err) {
|
||||
|
||||
@@ -5,7 +5,9 @@ module.exports = function incrementMapViewCount (metadataBackend) {
|
||||
const { mapConfig, user } = res.locals;
|
||||
const statTag = mapConfig.obj().stat_tag;
|
||||
|
||||
res.set('Carto-Stat-Tag', `${statTag}`);
|
||||
if (statTag) {
|
||||
res.set('Carto-Stat-Tag', `${statTag}`);
|
||||
}
|
||||
|
||||
// Error won't blow up, just be logged.
|
||||
metadataBackend.incMapviewCount(user, statTag, (err) => {
|
||||
|
||||
Reference in New Issue
Block a user