fix url encoding (#2135)

This commit is contained in:
Shuchang Zheng
2025-04-12 13:35:43 -07:00
committed by GitHub
parent fe6e26250c
commit cb46232cff

View File

@@ -12,7 +12,6 @@ from urllib.parse import unquote, urlparse
import aiohttp import aiohttp
import structlog import structlog
from multidict import CIMultiDictProxy from multidict import CIMultiDictProxy
from yarl import URL
from skyvern.config import settings from skyvern.config import settings
from skyvern.constants import BROWSER_DOWNLOAD_TIMEOUT, BROWSER_DOWNLOADING_SUFFIX, REPO_ROOT_DIR from skyvern.constants import BROWSER_DOWNLOAD_TIMEOUT, BROWSER_DOWNLOADING_SUFFIX, REPO_ROOT_DIR
@@ -84,7 +83,7 @@ async def download_file(url: str, max_size_mb: int | None = None) -> str:
async with aiohttp.ClientSession(raise_for_status=True) as session: async with aiohttp.ClientSession(raise_for_status=True) as session:
LOG.info("Starting to download file", url=url) LOG.info("Starting to download file", url=url)
async with session.get(URL(url, encoded=True)) as response: async with session.get(url) as response:
# Check the content length if available # Check the content length if available
if max_size_mb and response.content_length and response.content_length > max_size_mb * 1024 * 1024: if max_size_mb and response.content_length and response.content_length > max_size_mb * 1024 * 1024:
# todo: move to root exception.py # todo: move to root exception.py