This commit is contained in:
Timothy Jaeryang Baek committed 2026-05-09 21:05:49 +09:00
1 parent 2fa3b84241
commit df42d96c95
7 files changed
+22 -10

No files matched your search

+2 -1
View File
@@ -43,6 +43,7 @@ from open_webui.retrieval.loaders.youtube import YoutubeLoader
from open_webui.env import (
AIOHTTP_CLIENT_TIMEOUT,
AIOHTTP_CLIENT_ALLOW_REDIRECTS,
OFFLINE_MODE,
ENABLE_FORWARD_USER_INFO_HEADERS,
AIOHTTP_CLIENT_SESSION_SSL,
@@ -185,7 +186,7 @@ def get_content_from_url(request, url: str) -> str:
# re-validation would let an attacker reach private IPs (RFC1918, loopback,
# cloud-metadata 169.254.169.254) via a public host that redirects internally.
try:
response = requests.get(url, stream=True, timeout=30, allow_redirects=False)
response = requests.get(url, stream=True, timeout=30, allow_redirects=AIOHTTP_CLIENT_ALLOW_REDIRECTS)
response.raise_for_status()
content_type = response.headers.get('Content-Type', '')
except Exception:
+3 -3
View File
@@ -48,7 +48,7 @@ from open_webui.config import (
WEB_FETCH_FILTER_LIST,
)
from open_webui.utils.misc import is_string_allowed
from open_webui.env import AIOHTTP_CLIENT_SESSION_SSL
from open_webui.env import AIOHTTP_CLIENT_SESSION_SSL, AIOHTTP_CLIENT_ALLOW_REDIRECTS
log = logging.getLogger(__name__)
@@ -494,7 +494,7 @@ class SafeWebBaseLoader(WebBaseLoader):
# re-validation. Matches the policy enforced on the async _fetch() path below.
self.requests_kwargs = {
**(self.requests_kwargs or {}),
'allow_redirects': False,
'allow_redirects': AIOHTTP_CLIENT_ALLOW_REDIRECTS,
}
async def _fetch(self, url: str, retries: int = 3, cooldown: int = 2, backoff: float = 1.5) -> str:
@@ -513,7 +513,7 @@ class SafeWebBaseLoader(WebBaseLoader):
async with session.get(
url,
**(self.requests_kwargs | kwargs),
allow_redirects=False,
allow_redirects=AIOHTTP_CLIENT_ALLOW_REDIRECTS,
) as response:
if self.raise_for_status:
response.raise_for_status()