From 7ad0f2472750105c983700bb1b4d0fc187421613 Mon Sep 17 00:00:00 2001 From: yihong0618 Date: Tue, 26 Nov 2024 15:49:45 +0800 Subject: [PATCH] fix: better way to handle github dsl url close #11113 Signed-off-by: yihong0618 --- api/services/app_dsl_service.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/api/services/app_dsl_service.py b/api/services/app_dsl_service.py index b3c919dbd9df92..a4d71d5424a19b 100644 --- a/api/services/app_dsl_service.py +++ b/api/services/app_dsl_service.py @@ -113,6 +113,10 @@ def import_app( ) 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