def sanitize_path(path:str, allow_absolute_path:bool=False, e
rror_text="Absolute database path detected", exception_text
="Detected an attempt of path traversal. Are you kidding m
e?"):
 if path is None:
 return path
 # Regular expression to detect patterns like "...." and m
ultiple forward slashes
 suspicious_patterns = re.compile(r'(\\.\\.+)|(/+/)')
 if suspicious_patterns.search(str(path)) or ((not allow_a
bsolute_path) and Path(path).is_absolute()):
 ASCIIColors.error(error_text)
 raise HTTPException(status_code=400, detail=exception
_text)
 if not allow_absolute_path:
 path = path.lstrip('/')
 return path