From a8633e34b247ad483ba3de81a518d4db11be7446 Mon Sep 17 00:00:00 2001 From: Shawn Date: Thu, 25 Oct 2018 14:07:11 -0500 Subject: [PATCH] Fix checking length of endefined --- server/middleware/logMetricsMiddleware.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/middleware/logMetricsMiddleware.js b/server/middleware/logMetricsMiddleware.js index 2ad4c5fa..3008900e 100644 --- a/server/middleware/logMetricsMiddleware.js +++ b/server/middleware/logMetricsMiddleware.js @@ -9,7 +9,7 @@ function logMetricsMiddleware(req, res, next) { let referrer = req.get('referrer'); - if(referrer.length > 255) { + if(referrer && referrer.length > 255) { // Attempt to "safely" clamp long URLs referrer = /(.*?)#.*/.exec(referrer)[1];