Loading lib/galaxy/files/sources/_pyfilesystem2.py +21 −13 Original line number Diff line number Diff line Loading @@ -12,9 +12,11 @@ from typing import ( ) import fs import fs.errors from fs.base import FS from typing_extensions import Unpack from galaxy.exceptions import MessageException from . import ( BaseFilesSource, FilesSourceOptions, Loading Loading @@ -42,7 +44,7 @@ class PyFilesystem2FilesSource(BaseFilesSource): def _list(self, path="/", recursive=False, user_context=None, opts: Optional[FilesSourceOptions] = None): """Return dictionary of 'Directory's and 'File's.""" try: with self._open_fs(user_context=user_context, opts=opts) as h: if recursive: res: List[Dict[str, Any]] = [] Loading @@ -55,6 +57,12 @@ class PyFilesystem2FilesSource(BaseFilesSource): res = h.scandir(path, namespaces=["details"]) to_dict = functools.partial(self._resource_info_to_dict, path) return list(map(to_dict, res)) except fs.errors.PermissionDenied as e: raise MessageException( f"Permission Denied. Reason: {e}. Please check your credentials in your preferences for {self.label}." ) except fs.errors.FSError as e: raise MessageException(f"Problem listing file source path {path}. Reason: {e}") from e def _realize_to(self, source_path, native_path, user_context=None, opts: Optional[FilesSourceOptions] = None): with open(native_path, "wb") as write_file: Loading Loading
lib/galaxy/files/sources/_pyfilesystem2.py +21 −13 Original line number Diff line number Diff line Loading @@ -12,9 +12,11 @@ from typing import ( ) import fs import fs.errors from fs.base import FS from typing_extensions import Unpack from galaxy.exceptions import MessageException from . import ( BaseFilesSource, FilesSourceOptions, Loading Loading @@ -42,7 +44,7 @@ class PyFilesystem2FilesSource(BaseFilesSource): def _list(self, path="/", recursive=False, user_context=None, opts: Optional[FilesSourceOptions] = None): """Return dictionary of 'Directory's and 'File's.""" try: with self._open_fs(user_context=user_context, opts=opts) as h: if recursive: res: List[Dict[str, Any]] = [] Loading @@ -55,6 +57,12 @@ class PyFilesystem2FilesSource(BaseFilesSource): res = h.scandir(path, namespaces=["details"]) to_dict = functools.partial(self._resource_info_to_dict, path) return list(map(to_dict, res)) except fs.errors.PermissionDenied as e: raise MessageException( f"Permission Denied. Reason: {e}. Please check your credentials in your preferences for {self.label}." ) except fs.errors.FSError as e: raise MessageException(f"Problem listing file source path {path}. Reason: {e}") from e def _realize_to(self, source_path, native_path, user_context=None, opts: Optional[FilesSourceOptions] = None): with open(native_path, "wb") as write_file: Loading