Skip to content

Automate browser based workflows with AI

Make email attachments' names simpler (#208)

Kerem Yilmazd059619e5e33
diff --git a/skyvern/forge/sdk/workflow/models/block.py b/skyvern/forge/sdk/workflow/models/block.py
index f25220e30..91886fac5 100644
--- a/skyvern/forge/sdk/workflow/models/block.py
+++ b/skyvern/forge/sdk/workflow/models/block.py
@@ -9,7 +9,6 @@ from enum import StrEnum
from pathlib import Path
from tempfile import NamedTemporaryFile
from typing import Annotated, Any, Literal, Union
-from urllib.parse import urlparse
import filetype
import structlog
@@ -822,10 +821,11 @@ class SendEmailBlock(Block):
extension = None
maintype, subtype = ctype.split("/", 1)
- attachment_filename = urlparse(filename).path.replace("/", "_")
+ attachment_path = Path(path)
+ attachment_filename = attachment_path.name
# Check if the filename has an extension
- if not Path(attachment_filename).suffix:
+ if not attachment_path.suffix:
# If no extension, guess it based on the MIME type
if extension:
attachment_filename += f".{extension}"