Skip to content

Commit

Permalink
URL parameter sanitized for neoforge filter
Browse files Browse the repository at this point in the history
  • Loading branch information
mindstorm38 committed Nov 9, 2023
1 parent b7b86fd commit 86c77c2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion portablemc/forge.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
The NeoForge support is still unstable API.
"""

from urllib import parse as url_parse
from zipfile import ZipFile
from pathlib import Path
from io import BytesIO
Expand Down Expand Up @@ -455,7 +456,7 @@ def _request_neoforge_version(game_version: str) -> Optional[str]:
"""
try:
# NOTE: For now we don't sanitize the parameter.
url = f"https://maven.neoforged.net/api/maven/latest/version/releases/net%2Fneoforged%2Fforge?filter={game_version}"
url = f"https://maven.neoforged.net/api/maven/latest/version/releases/net%2Fneoforged%2Fforge?filter={url_parse.quote(game_version)}"
ret = http_request("GET", url, accept="application/json").json()
loader_version = ret.get("version", "")
if not loader_version.startswith(f"{game_version}-"):
Expand Down

0 comments on commit 86c77c2

Please sign in to comment.