Fix an issue if forward slash is specified at the end of the settings URL

This commit is contained in:
Frisk 2023-12-14 17:19:43 +01:00
parent f34643f77c
commit 2bc6a32f77

View file

@ -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"