From f34a59810c01022c81b61b939fb47c8fa6f26618 Mon Sep 17 00:00:00 2001 From: z4yx Date: Sun, 5 Apr 2020 21:48:40 +0800 Subject: [PATCH] fix URL construction --- yum-sync.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/yum-sync.py b/yum-sync.py index 3bae3f6..24329e4 100755 --- a/yum-sync.py +++ b/yum-sync.py @@ -63,11 +63,12 @@ def main(): name = substitute_vars(args.repo_name, vardict) url = substitute_vars(args.base_url, vardict) try: - r = requests.head((url+"/repodata/repomd.xml").replace("//", "/"), timeout=(7,7)) + probe_url = url + ('' if url.endswith('/') else '/') + "repodata/repomd.xml" + r = requests.head(probe_url, timeout=(7,7)) if r.status_code < 400 or r.status_code == 403: yield (name, url) else: - print(url, "->", r.status_code) + print(probe_url, "->", r.status_code) except: traceback.print_exc()