mirror of
https://github.com/Skyvern-AI/skyvern.git
synced 2025-09-17 02:39:40 +00:00
SendEmailBlock: Fail silently if file/folder is missing (#898)
This commit is contained in:
parent
f9da9f63ed
commit
17c680d439
1 changed files with 20 additions and 9 deletions
|
@ -868,16 +868,27 @@ class SendEmailBlock(Block):
|
||||||
)
|
)
|
||||||
|
|
||||||
# if the file path is a directory, add all files in the directory, skip directories, limit to 10 files
|
# if the file path is a directory, add all files in the directory, skip directories, limit to 10 files
|
||||||
if os.path.exists(path) and os.path.isdir(path):
|
if os.path.exists(path):
|
||||||
for file in os.listdir(path):
|
if os.path.isdir(path):
|
||||||
if os.path.isdir(os.path.join(path, file)):
|
for file in os.listdir(path):
|
||||||
LOG.warning("SendEmailBlock: Skipping directory", file=file)
|
if os.path.isdir(os.path.join(path, file)):
|
||||||
continue
|
LOG.warning("SendEmailBlock: Skipping directory", file=file)
|
||||||
file_path = os.path.join(path, file)
|
continue
|
||||||
file_paths.append(file_path)
|
file_path = os.path.join(path, file)
|
||||||
else:
|
file_paths.append(file_path)
|
||||||
# covers the case where the file path is a single file, a url, or an S3 uri
|
else:
|
||||||
|
# covers the case where the file path is a single file
|
||||||
|
file_paths.append(path)
|
||||||
|
# check if path is a url, or an S3 uri
|
||||||
|
elif (
|
||||||
|
path.startswith("http://")
|
||||||
|
or path.startswith("https://")
|
||||||
|
or path.startswith("s3://")
|
||||||
|
or path.startswith("www.")
|
||||||
|
):
|
||||||
file_paths.append(path)
|
file_paths.append(path)
|
||||||
|
else:
|
||||||
|
LOG.warning("SendEmailBlock: File not found", file_path=path)
|
||||||
|
|
||||||
return file_paths
|
return file_paths
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue