Skip to content

Commit 71cb89c

Browse files
committed
bugfix: Check history dir path before refreshing
1 parent fcdd5fd commit 71cb89c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

modules/utils.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,9 @@ def get_history_names(user_name=""):
482482
if user_name == "" and hide_history_when_not_logged_in:
483483
return []
484484
else:
485+
user_history_dir = os.path.join(HISTORY_DIR, user_name)
486+
# ensure the user history directory is inside the HISTORY_DIR
487+
assert os.path.realpath(user_history_dir).startswith(os.path.realpath(HISTORY_DIR))
485488
history_files = get_file_names_by_last_modified_time(
486489
os.path.join(HISTORY_DIR, user_name)
487490
)

0 commit comments

Comments
 (0)