caching_proxy.py: only take .deb and by-hash artifacts from the old path

main
parent db2be70f88
commit 1ffa32f590
Signed by untrusted user: josch
GPG Key ID: F2CBA5C78FBD83E1

@ -46,7 +46,12 @@ class ProxyRequestHandler(http.server.BaseHTTPRequestHandler):
newpath = pathlib.Path("/dev/null")
# copy from oldpath to newpath and send back to client
if oldpath.exists():
# Only take files from the old cache if they are .deb files or Packages
# files in the by-hash directory as only those are unique by their path
# name. Other files like InRelease files have to be downloaded afresh.
if oldpath.exists() and (
oldpath.suffix == ".deb" or "by-hash" in oldpath.parts
):
print(f"proxy cached: {self.path}", file=sys.stderr)
self.wfile.write(b"HTTP/1.1 200 OK\r\n")
self.send_header("Content-Length", oldpath.stat().st_size)

Loading…
Cancel
Save