From c81d3ed1d6c82859aa4dfea780dc89dfb8646511 Mon Sep 17 00:00:00 2001 From: R1kaB3rN <100738684+R1kaB3rN@users.noreply.github.com> Date: Sun, 2 Jun 2024 13:12:54 -0700 Subject: [PATCH] umu_runtime: fix bug when deleting VERSIONS.txt - The launcher would fail to restore this fail after it was deleted because it did not handle the redirect. However, even if the redirect was handled, the resource wasn't specified correctly. For now, just handle the 301 error --- umu/umu_runtime.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/umu/umu_runtime.py b/umu/umu_runtime.py index 2968cb43..e9cd6f07 100644 --- a/umu/umu_runtime.py +++ b/umu/umu_runtime.py @@ -280,11 +280,23 @@ def _update_umu( # NOTE: Change 'SteamLinuxRuntime_sniper.VERSIONS.txt' when the version # changes (e.g., steamrt4 -> SteamLinuxRuntime_medic.VERSIONS.txt) if not local.joinpath("VERSIONS.txt").is_file(): - endpoint_sniper: str = f"/{codename}/images/{build_id}" + versions: str = "SteamLinuxRuntime_sniper.VERSIONS.txt" + endpoint_sniper: str = f"/{codename}/images/{build_id}/{versions}" CLIENT_SESSION.request("GET", endpoint_sniper) resp = CLIENT_SESSION.getresponse() log.warning("VERSIONS.txt not found") log.console("Restoring VERSIONS.txt...") + + # Handle the redirect + if resp.status == 301: + location: str = resp.getheader("Location") + log.debug("Location: %s", resp.getheader("Location")) + # The stdlib requires reading the entire response body before + # making another request + resp.read() + CLIENT_SESSION.request("GET", f"{location}/{build_id}/{versions}") + resp = CLIENT_SESSION.getresponse() + if resp.status != 200: log.warning( "repo.steampowered.com returned the status: %s",