Skip to content

Commit

Permalink
Handle trailing slash in template url (#108)
Browse files Browse the repository at this point in the history
  • Loading branch information
bsquizz authored Sep 2, 2021
1 parent 19fe7f7 commit 12c8cc5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion bonfire/qontract.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import json
import copy
import logging
from urllib.parse import urlparse

from gql import gql
from gql import Client as GQLClient
Expand Down Expand Up @@ -227,7 +228,11 @@ def _add_component(apps, env, app_name, saas_file, resource_template, target, de
)
host = "github" if "github" in url else "gitlab"

org, repo = url.split("/")[-2:]
try:
parsed_url = urlparse(url)
org, repo = parsed_url.path.rstrip("/").split("/")[-2:]
except (ValueError, IndexError) as err:
raise ValueError(f"invalid repo url '{url}': {err}")

# merge the various layers of parameters
p = copy.deepcopy(_to_dict(env["parameters"]))
Expand Down

0 comments on commit 12c8cc5

Please sign in to comment.