Skip to content

Commit

Permalink
chore: code format
Browse files Browse the repository at this point in the history
Signed-off-by: -LAN- <laipz8200@outlook.com>
  • Loading branch information
laipz8200 committed Jan 2, 2025
1 parent 8779dc0 commit 55d09a2
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions api/services/app_dsl_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import uuid
from enum import StrEnum
from typing import Optional, cast
from urllib.parse import urlparse
from uuid import uuid4

import yaml # type: ignore
Expand All @@ -10,7 +11,6 @@
from sqlalchemy import select
from sqlalchemy.orm import Session

from urllib.parse import urlparse
from core.helper import ssrf_proxy
from events.app_event import app_model_config_was_updated, app_was_created
from extensions.ext_redis import redis_client
Expand Down Expand Up @@ -116,7 +116,11 @@ def import_app(
max_size = 10 * 1024 * 1024 # 10MB
# tricky way to handle url from github to github raw url
parsed_url = urlparse(yaml_url)
if parsed_url.scheme == "https" and parsed_url.netloc == "github.com" and parsed_url.path.endswith((".yml", ".yaml")):
if (
parsed_url.scheme == "https"
and parsed_url.netloc == "github.com"
and parsed_url.path.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))
Expand Down

0 comments on commit 55d09a2

Please sign in to comment.