mirror of
https://github.com/aljazceru/dev-gpt.git
synced 2026-01-22 06:54:19 +01:00
⛰ fix: prevent large string content in error message
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import os
|
||||
import platform
|
||||
import string
|
||||
import re
|
||||
|
||||
if platform.system() == "Windows":
|
||||
os.system("color")
|
||||
@@ -39,4 +40,10 @@ def get_template_parameters(formatted_string):
|
||||
if field_name is not None:
|
||||
parameters.append(field_name)
|
||||
|
||||
return parameters
|
||||
return parameters
|
||||
|
||||
def clean_large_words(text):
|
||||
"""Large words like base64 strings are returned by omitting the middle part of the word."""
|
||||
pattern = r'\b([a-zA-Z0-9+/]{20})([a-zA-Z0-9+/]{200,})([a-zA-Z0-9+/]{20})\b'
|
||||
cleaned_text = re.sub(pattern, r'\1...\3', text)
|
||||
return cleaned_text
|
||||
Reference in New Issue
Block a user