Skip to content

Commit

Permalink
Merge pull request #507 from villasv/unregion
Browse files Browse the repository at this point in the history
Remove region from url when computing url prefix
  • Loading branch information
jaymccon authored Mar 9, 2020
2 parents 7c4769c + b1011e8 commit 6890f01
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion taskcat/_cfn/template.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging
import re
from pathlib import Path
from typing import Dict, List, Union

Expand Down Expand Up @@ -102,9 +103,12 @@ def _get_relative_url(self, path: str) -> str:
def url_prefix(self) -> str:
if not self.url:
return ""
regionless_url = re.sub(
r"\.s3\.(.*)\.amazonaws\.com", ".s3.amazonaws.com", self.url,
)
suffix = str(self.template_path).replace(str(self.project_root), "")
suffix_length = len(suffix.lstrip("/").split("/"))
url_prefix = "/".join(self.url.split("/")[0:-suffix_length])
url_prefix = "/".join(regionless_url.split("/")[0:-suffix_length])
return url_prefix

def _find_children(self) -> None: # noqa: C901
Expand Down

0 comments on commit 6890f01

Please sign in to comment.