mirror of
https://github.com/agent0ai/agent-zero.git
synced 2026-12-03 03:55:12 +00:00
fixes - allowed hosts, image get folders, extensions after termination
This commit is contained in:
parent
0d948be090
commit
08693c22f0
5 changed files with 30 additions and 16 deletions
|
|
@ -505,12 +505,14 @@ def dirname(path: str):
|
|||
|
||||
|
||||
def is_in_base_dir(path: str):
|
||||
# check if the given path is within the base directory
|
||||
base_dir = get_base_dir()
|
||||
# normalize paths to handle relative paths and symlinks
|
||||
return is_in_dir(path,get_base_dir())
|
||||
|
||||
|
||||
def is_in_dir(path:str,dir:str):
|
||||
# check if the given path is within the directory
|
||||
abs_path = os.path.abspath(path)
|
||||
# check if the absolute path starts with the base directory
|
||||
return os.path.commonpath([abs_path, base_dir]) == base_dir
|
||||
abs_dir = os.path.abspath(dir)
|
||||
return os.path.commonpath([abs_path, abs_dir]) == abs_dir
|
||||
|
||||
|
||||
def get_subdirectories(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue