fix that guy who's mad
This commit is contained in:
parent
56952091a3
commit
17653449ad
@ -24,6 +24,7 @@ from datetime import datetime
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from types import ModuleType
|
from types import ModuleType
|
||||||
from typing import Any, Callable, List, NamedTuple, Optional
|
from typing import Any, Callable, List, NamedTuple, Optional
|
||||||
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
import httpx
|
import httpx
|
||||||
import typer
|
import typer
|
||||||
@ -1679,9 +1680,11 @@ def validate_and_create_app_using_remote_template(
|
|||||||
|
|
||||||
template_url = templates[template].code_url
|
template_url = templates[template].code_url
|
||||||
else:
|
else:
|
||||||
|
template_parsed_url = urlparse(template)
|
||||||
# Check if the template is a github repo.
|
# Check if the template is a github repo.
|
||||||
if template.startswith("https://github.com"):
|
if template_parsed_url.hostname == "github.com":
|
||||||
template_url = f"{template.strip('/').replace('.git', '')}/archive/main.zip"
|
path = template_parsed_url.path.strip("/").removesuffix(".git")
|
||||||
|
template_url = f"https://github.com/{path}/archive/main.zip"
|
||||||
else:
|
else:
|
||||||
console.error(f"Template `{template}` not found or invalid.")
|
console.error(f"Template `{template}` not found or invalid.")
|
||||||
raise typer.Exit(1)
|
raise typer.Exit(1)
|
||||||
|
Loading…
Reference in New Issue
Block a user