diff --git a/fileglancer/filestore.py b/fileglancer/filestore.py index f25f3b67..f86e314d 100644 --- a/fileglancer/filestore.py +++ b/fileglancer/filestore.py @@ -149,7 +149,8 @@ def __init__(self, file_share_path: FileSharePath): """ # Expand ~/ to the user's home directory (within user context) expanded_path = os.path.expanduser(file_share_path.mount_path) - self.root_path = os.path.abspath(expanded_path) + # Use realpath to resolve symlinks for consistent path operations (e.g., /var -> /private/var on macOS) + self.root_path = os.path.realpath(expanded_path) def _check_path_in_root(self, path: Optional[str]) -> str: diff --git a/tests/test_filestore.py b/tests/test_filestore.py index 07113ae1..a7933106 100644 --- a/tests/test_filestore.py +++ b/tests/test_filestore.py @@ -47,7 +47,8 @@ def test_unmounted_filestore(): def test_get_root_path(filestore, test_dir): - assert filestore.get_root_path() == test_dir + # Root path should be the canonicalized/resolved version of test_dir + assert filestore.get_root_path() == os.path.realpath(test_dir) def test_get_root_info(filestore, test_dir):