From b7ba63688de93ad810942f5a56dea4e44831d805 Mon Sep 17 00:00:00 2001 From: Kumi Date: Sun, 18 Aug 2024 11:22:19 +0200 Subject: [PATCH] fix(wiki_article): correct URL escaping for title Corrected the URL escaping for titles in `wiki_article` function by setting `escape` flag to `False`. This ensures the correct handling of titles with special characters. Resolves potential issues with fetching article content due to over-escaping. --- src/wikimore/app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wikimore/app.py b/src/wikimore/app.py index a37e8db..9e98069 100644 --- a/src/wikimore/app.py +++ b/src/wikimore/app.py @@ -119,7 +119,7 @@ def wiki_article(project, lang, title): logger.debug(f"Fetching {title} from {base_url}") - url = f"{base_url}/w/api.php?action=query&format=json&titles={escape(title.replace(' ', '_'), True)}&prop=revisions&rvprop=content&rvparse=1" + url = f"{base_url}/w/api.php?action=query&format=json&titles={escape(title.replace(' ', '_'), False)}&prop=revisions&rvprop=content&rvparse=1" with urllib.request.urlopen(url) as response: data = json.loads(response.read().decode()) pages = data["query"]["pages"]