From c749e8fd12ff00800ca0ddc2b22544dbec601ab3 Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Wed, 28 Dec 2022 18:00:40 +0100 Subject: arch-proxy.py: ignore empty files in cache --- arch-proxy.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch-proxy.py b/arch-proxy.py index 5a7b2c2..a456c77 100755 --- a/arch-proxy.py +++ b/arch-proxy.py @@ -167,6 +167,9 @@ class RequestHandler(http.server.BaseHTTPRequestHandler): try: # Try to open cached file and yield data from it stat_info = os.stat(path) + if stat_info.st_size == 0: + # Treat empty files as missing. + raise FileNotFoundError response_headers = {'Last-Modified': epoch_to_text(stat_info.st_mtime)} self.send_ok(stat_info.st_size, response_headers, -- cgit v1.2.1