From db170c6254b493b0c3a17e1cb3792957bdec2fc9 Mon Sep 17 00:00:00 2001 From: Stefano Belforte Date: Fri, 18 Mar 2022 15:33:35 +0100 Subject: [PATCH] temporary hack to avoid HTTP code strings in messages (#7147) (#7148) --- src/python/ServerUtilities.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/python/ServerUtilities.py b/src/python/ServerUtilities.py index a3dd6c62a8..a127fd6034 100644 --- a/src/python/ServerUtilities.py +++ b/src/python/ServerUtilities.py @@ -160,10 +160,14 @@ def truncateError(msg): """Truncate the error message to the first 7400 chars if needed, and add a message if we truncate it. See https://github.com/dmwm/CRABServer/pull/4867#commitcomment-12086393 """ - MSG_LIMIT = 7500 + MSG_LIMIT = 1100 + # hack to avoid passing HTTP error code to message parsing code in CRABClient/CrabRestInterface.py + codeString = 'HTTP/1.' + if codeString in msg : + msg = msg.replace(codeString,'HTTP 1.') if len(msg) > MSG_LIMIT: truncMsg = msg[:MSG_LIMIT - 100] - truncMsg += "\n[... message truncated to the first 7400 chars ...]" + truncMsg += "\n[... message truncated to the first %d chars ...]" % (MSG_LIMIT-100) return truncMsg else: return msg