Skip to content

Commit

Permalink
temporary hack to avoid HTTP code strings in messages (#7147) (#7148)
Browse files Browse the repository at this point in the history
  • Loading branch information
belforte authored Mar 18, 2022
1 parent 7543003 commit db170c6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/python/ServerUtilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit db170c6

Please sign in to comment.