From 7ab79e472894fe4e5d672ef4d98ad4d03cea7b8b Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Sun, 19 Oct 2014 11:08:01 +0200 Subject: [PATCH] Added length limitation of data (just send first 3000 chars of log messages). --- .../javascripts/app/lib/app_init/track.js.coffee | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/app/lib/app_init/track.js.coffee b/app/assets/javascripts/app/lib/app_init/track.js.coffee index ef8f49927..fb84278ba 100644 --- a/app/assets/javascripts/app/lib/app_init/track.js.coffee +++ b/app/assets/javascripts/app/lib/app_init/track.js.coffee @@ -62,16 +62,22 @@ class _trackSingleton $(document).bind( 'ajaxComplete', ( e, request, settings ) => # do not log ui requests - if settings.url && settings.url.substr(settings.url-3,3) isnt '/ui' + if settings.url && settings.url.substr(settings.url.length-3,3) isnt '/ui' level = 'notice' responseText = '' if request.status >= 400 level = 'error' responseText = request.responseText - # delete passwords form data - if settings.data && typeof settings.data is 'string' - settings.data = settings.data.replace(/"password":".+?"/gi, '"password":"xxx"') + if settings.data + + # add length limitation + if settings.data.length > 3000 + settings.data = settings.data.substr(0,3000) + + # delete passwords form data + if typeof settings.data is 'string' + settings.data = settings.data.replace(/"password":".+?"/gi, '"password":"xxx"') @log( 'ajax.send',