diff --git a/constructor/utils.py b/constructor/utils.py index 277c2cead..4b2c6352a 100644 --- a/constructor/utils.py +++ b/constructor/utils.py @@ -178,6 +178,11 @@ def ensure_transmuted_ext(info, url): def get_final_url(info, url): mapping = info.get('channels_remap', []) + if not url.lower().endswith((".tar.bz2", ".conda", "/")): + url += "/" + added_slash = True + else: + added_slash = False for entry in mapping: src = entry['src'] dst = entry['dest'] @@ -186,7 +191,6 @@ def get_final_url(info, url): srcs = tuple( dict.fromkeys( [ - src, src.replace("http://", "https://"), src.replace("https://", "http://") ] @@ -195,11 +199,14 @@ def get_final_url(info, url): else: srcs = (src,) if url.startswith(srcs): + new_url = url for src in srcs: - new_url = url.replace(src, dst) + new_url = new_url.replace(src, dst) if url.endswith(".tar.bz2"): logger.warning("You need to make the package %s available " "at %s", url.rsplit('/', 1)[1], new_url) + if added_slash: + new_url = new_url[:-1] return new_url return url