|
6 | 6 | from ..core.enum import FileAccessMode |
7 | 7 | from ..lib.storage import asynfs, commonfs |
8 | 8 | from ..objects.asynchronous.invitation import AsyncInvitation |
9 | | -from ..exceptions.io.core import ListDirectoryError, GetMetadataError |
| 9 | +from ..exceptions.io.core import ListDirectoryError, GetMetadataError, ExternalShareError |
10 | 10 |
|
11 | 11 |
|
12 | 12 | async def handle_ls(args): |
@@ -83,9 +83,9 @@ async def download(invitation, resource, objects=None, archive=False, destinatio |
83 | 83 | jobs.append(download(invitation, r, destination=target)) |
84 | 84 | except (GetMetadataError, ListDirectoryError): |
85 | 85 | print(f"error: failed to obtain properties or list a directory: '{args.src}'", file=sys.stderr) |
86 | | - sys.exit(1) |
87 | 86 |
|
88 | | - await asyncio.gather(*jobs) |
| 87 | + if jobs: |
| 88 | + await asyncio.gather(*jobs) |
89 | 89 |
|
90 | 90 | except PermissionError: |
91 | 91 | print(f"error: permission denied: Cannot create files and folders at '{target}'.", file=sys.stderr) |
@@ -123,9 +123,10 @@ async def handle_upload(args): |
123 | 123 | for p in args.files: |
124 | 124 | jobs.append(invitation.files.upload_file(p, destination)) |
125 | 125 |
|
126 | | - await asyncio.gather(*jobs) |
| 126 | + if jobs: |
| 127 | + await asyncio.gather(*jobs) |
127 | 128 |
|
128 | | - except GetMetadataError: |
| 129 | + except (GetMetadataError, ExternalShareError): |
129 | 130 | print(f"error: failed to obtain properties for directory: '{args.dest}'", file=sys.stderr) |
130 | 131 | sys.exit(1) |
131 | 132 |
|
|
0 commit comments