fix: better way to handle github dsl url close #11113 (#11125)

Signed-off-by: yihong0618 <zouzou0208@gmail.com>
This commit is contained in:
yihong 2024-11-26 19:39:55 +08:00 committed by GitHub
parent 79db920fa7
commit 2927493cf3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -113,6 +113,10 @@ class AppDslService:
)
try:
max_size = 10 * 1024 * 1024 # 10MB
# tricky way to handle url from github to github raw url
if yaml_url.startswith("https://github.com") and yaml_url.endswith((".yml", ".yaml")):
yaml_url = yaml_url.replace("https://github.com", "https://raw.githubusercontent.com")
yaml_url = yaml_url.replace("/blob/", "/")
response = ssrf_proxy.get(yaml_url.strip(), follow_redirects=True, timeout=(10, 10))
response.raise_for_status()
content = response.content