From 904957b017179d530c60f4b231a26cc2b8747987 Mon Sep 17 00:00:00 2001 From: Alexander_Kabui Date: Fri, 13 Sep 2024 14:17:19 +0300 Subject: Use urlencode for query strings. --- gn2/wqflask/api/markdown.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'gn2/wqflask') 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, -- cgit v1.2.3