From 7d81c42b9c8053447182715dec0af88c55987ffb Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Tue, 6 Mar 2018 10:32:28 +0000 Subject: [PATCH] More explicit handling of empty-string country-code --- .../app/coffee/Features/Analytics/AnalyticsController.coffee | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/services/web/app/coffee/Features/Analytics/AnalyticsController.coffee b/services/web/app/coffee/Features/Analytics/AnalyticsController.coffee index 38f5a2e9a4..38029219ee 100644 --- a/services/web/app/coffee/Features/Analytics/AnalyticsController.coffee +++ b/services/web/app/coffee/Features/Analytics/AnalyticsController.coffee @@ -7,10 +7,12 @@ module.exports = AnalyticsController = updateEditingSession: (req, res, next) -> userId = AuthenticationController.getLoggedInUserId(req) projectId = req.params.projectId + countryCode = null if userId? GeoIpLookup.getDetails req.ip, (err, geoDetails) -> - countryCode = geoDetails?.country_code || null + if geoDetails?.country_code? and geoDetails.country_code != "" + countryCode = geoDetails.country_code AnalyticsManager.updateEditingSession userId, projectId, countryCode, (error) -> respondWith(error, res, next) else