mirror of
https://github.com/cpacker/MemGPT.git
synced 2025-06-03 04:30:22 +00:00
fix(server): handle null key string in utils (check_null_key)
Ensure that the `shorten_key` function in `utils.py` returns the key string itself when it is null or empty, preventing further processing that could lead to errors.
This commit is contained in:
parent
febee38db3
commit
78a11c50cb
@ -37,6 +37,8 @@ def shorten_key_middle(key_string, chars_each_side=3):
|
||||
Returns:
|
||||
str: The shortened key string with an ellipsis in the middle.
|
||||
"""
|
||||
if not key_string:
|
||||
return key_string
|
||||
key_length = len(key_string)
|
||||
if key_length <= 2 * chars_each_side:
|
||||
return "..." # Return ellipsis if the key is too short
|
||||
|
Loading…
Reference in New Issue
Block a user