Skip to content

Commit

Permalink
umu_runtime: fix bug when deleting VERSIONS.txt
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
R1kaB3rN committed Jun 2, 2024
1 parent 4bacc26 commit c81d3ed
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion umu/umu_runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit c81d3ed

Please sign in to comment.