diff options
author | Alexander_Kabui | 2024-09-13 14:17:19 +0300 |
---|---|---|
committer | Alexander_Kabui | 2024-09-13 14:17:19 +0300 |
commit | 904957b017179d530c60f4b231a26cc2b8747987 (patch) | |
tree | 28c9fdab38e9fc21b54dd3b7ca42e46acf94f6b3 /gn2 | |
parent | d17010dfcd1cdb020619478120eefaeac04ed44d (diff) | |
download | genenetwork2-904957b017179d530c60f4b231a26cc2b8747987.tar.gz |
Use urlencode for query strings.
Diffstat (limited to 'gn2')
-rw-r--r-- | gn2/wqflask/api/markdown.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/gn2/wqflask/api/markdown.py b/gn2/wqflask/api/markdown.py index 126d887f..f0f94b52 100644 --- a/gn2/wqflask/api/markdown.py +++ b/gn2/wqflask/api/markdown.py @@ -7,6 +7,7 @@ import requests import markdown import os import sys +import urllib.parse from pathlib import Path from bs4 import BeautifulSoup # type: ignore @@ -35,8 +36,9 @@ def fetch_raw_markdown(file_path): This method fetches files from genenetwork:gn docs repo """ # todo remove hardcoded file path + safe_query = urllib.parse.urlencode({"file_path": file_path}) response = requests.get( - f"http://localhost:8091/edit?file_path={file_path}") + f"http://localhost:8091/edit?{safe_query}") response.raise_for_status() return response.json() @@ -184,7 +186,7 @@ def environments(): ) # Fallback: Fetch file from server file_data = fetch_raw_markdown( - file_path="general/environment/environment.md") + file_path="general/environments/environments.md") return (render_template( "environment.html", svg_data=None, |