From 2bc6a32f7765e10465f84f5ff908a819ff574fbf Mon Sep 17 00:00:00 2001 From: Frisk Date: Thu, 14 Dec 2023 17:19:43 +0100 Subject: [PATCH] Fix an issue if forward slash is specified at the end of the settings URL --- src/misc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/misc.py b/src/misc.py index ffd7c25..0506302 100644 --- a/src/misc.py +++ b/src/misc.py @@ -294,7 +294,7 @@ def prepare_paths(path: str, dry=False): misc_logger.critical("wiki_url is not specified in the settings. Please provide the wiki url in the settings and start the script again.") sys.exit(1) for url_scheme in (path, path.split("wiki")[0], urlunparse((*parsed_url[0:2], "", "", "", ""))): # check different combinations, it's supposed to be idiot-proof - tested = quick_try_url(url_scheme + "/api.php?action=query&format=json&meta=siteinfo") + tested = quick_try_url(url_scheme.rstrip("/") + "/api.php?action=query&format=json&meta=siteinfo") if tested: if not dry: WIKI_API_PATH = urlunparse((*parsed_url[0:2], "", "", "", "")) + tested.json()["query"]["general"]["scriptpath"] + "/api.php"