commit 002639d748ff3f1aba74670c775da6d6e9c8a777
parent 1a8a85fe33c3b333905cac638f4b25f7388cae3f
Author: archiveanon <>
Date: Sat, 28 Oct 2023 05:18:46 +0000
Raise error attempting to single upload a non-file
Diffstat:
1 file changed, 3 insertions(+), 0 deletions(-)
diff --git a/src/gofile/api.py b/src/gofile/api.py
@@ -96,6 +96,9 @@ def upload_single(
server: Optional[str] = None,
) -> GofileUpload:
# we return a GofileUpload instead of a GofileUploadResult so there's consistency between upload_single / upload_multiple
+ if not file.exists() or not file.is_file():
+ raise ValueError(f"Attempting to upload missing or non-file '{args.path}'")
+
if not server:
upload_server_result = get_upload_server()
server = upload_server_result.server