File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed
Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change 1414
1515from .interfaces import QfcException , QfcRequest , QfcRequestException
1616from .utils import calc_etag , log
17+ from pathvalidate import is_valid_filepath
18+
1719
1820logger = logging .getLogger (__file__ )
1921
@@ -493,9 +495,15 @@ def upload_file(
493495 show_progress: Whether to display a progress bar during upload.
494496 job_id: The job ID, required if `upload_type` is PACKAGE. Defaults to an empty string.
495497
498+ Raises:
499+ pathvalidate.ValidationError: Raised when the uploaded file does not have a valid filename.
500+
496501 Returns:
497502 The response object from the upload request.
498503 """
504+ # if the filepath is invalid, it will throw a new error `pathvalidate.ValidationError`
505+ is_valid_filepath (str (local_filename ))
506+
499507 with open (local_filename , "rb" ) as local_file :
500508 upload_file = local_file
501509 if show_progress :
Original file line number Diff line number Diff line change @@ -5,3 +5,4 @@ idna>=3.4
55requests >= 2.31.0
66tqdm >= 4.65.0
77urllib3 >= 2.0.7
8+ pathvalidate >= 3.2.1
You can’t perform that action at this time.
0 commit comments