Skip to content

Commit

Permalink
try to remove permission errors
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinBelthle committed Dec 20, 2024
1 parent d1ec7f8 commit 29f872c
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions antarest/study/storage/explorer_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,20 @@ def list_dir(
workspace = get_workspace_from_config(self.config, workspace_name, default_allowed=False)
directory_path = get_folder_from_workspace(workspace, workspace_directory_path)
directories = []
if os.access(directory_path, os.R_OK): # we don't want to try to read folders we can't access
for child in directory_path.iterdir():
if (
child.is_dir()
and not is_study_folder(child)
and not should_ignore_folder_for_scan(child)
and not child.name.startswith((".", "$"))
):
# we don't want to expose the full absolute path on the server
child_rel_path = child.relative_to(workspace.path)
directories.append(
NonStudyFolderDTO(path=child_rel_path, workspace=workspace_name, name=child.name)
)
try:
children = list(directory_path.iterdir())
except PermissionError:
children = [] # we don't want to try to read folders we can't access
for child in children:
if (
child.is_dir()
and not is_study_folder(child)
and not should_ignore_folder_for_scan(child)
and not child.name.startswith((".", "$"))
):
# we don't want to expose the full absolute path on the server
child_rel_path = child.relative_to(workspace.path)
directories.append(NonStudyFolderDTO(path=child_rel_path, workspace=workspace_name, name=child.name))
return directories

def list_workspaces(
Expand Down

0 comments on commit 29f872c

Please sign in to comment.