From a172bc68a455384c76fad9d48a43257154571f1e Mon Sep 17 00:00:00 2001 From: Sefa Eyeoglu Date: Thu, 10 Mar 2022 18:19:17 +0100 Subject: [PATCH] fix(updateFabric): request HEAD in try block --- updateFabric.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/updateFabric.py b/updateFabric.py index 72356a2..a46dfc7 100755 --- a/updateFabric.py +++ b/updateFabric.py @@ -65,17 +65,17 @@ def get_binary_file(path, url): def compute_jar_file(path, url): - headers = head_file(url) - - # These should result in the same metadata, except for the timestamp which might be a few minutes off for the - # fallback method + # These two approaches should result in the same metadata, except for the timestamp which might be a few minutes + # off for the fallback method try: # Let's not download a Jar file if we don't need to. + headers = head_file(url) tstamp = datetime.datetime.strptime(headers["Last-Modified"], DATETIME_FORMAT_HTTP) sha1 = get_plaintext(url + ".sha1") sha256 = get_plaintext(url + ".sha256") size = int(headers["Content-Length"]) - except requests.HTTPError: # Some older versions don't have a .sha256 file :( + except requests.HTTPError: + # Some older versions don't have a .sha256 file :( print(f"Falling back to downloading jar for {url}") jar_path = path + ".jar"