diff --git a/helpers/file_browser.py b/helpers/file_browser.py index 4f58d4c2e..ec94da4f5 100644 --- a/helpers/file_browser.py +++ b/helpers/file_browser.py @@ -169,7 +169,7 @@ class FileBrowser: raise ValueError("File exceeds 1 MB and cannot be edited") full_path = (self.base_dir / file_path).resolve() - if not str(full_path).startswith(str(self.base_dir)): + if not full_path.is_relative_to(self.base_dir.resolve()): raise ValueError("Invalid path") if full_path.exists() and full_path.is_dir(): raise ValueError("Target is a directory")