From 92b11ba74e29088504ffe27d40c603e0c84b71ef Mon Sep 17 00:00:00 2001 From: Adam Harrison Date: Fri, 8 Mar 2024 14:54:05 -0500 Subject: Remove files that don't match checksums. --- src/lpm.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lpm.lua b/src/lpm.lua index c611d51..0f2c7c2 100644 --- a/src/lpm.lua +++ b/src/lpm.lua @@ -576,7 +576,8 @@ function common.get(source, options) end local cache_dir = options.cache or CACHEDIR if not system.stat(cache_dir .. PATHSEP .. "files") then common.mkdirp(cache_dir .. PATHSEP .. "files") end - local cache_path = cache_dir .. PATHSEP .. "files" .. PATHSEP .. (checksum ~= "SKIP" and checksum or system.hash(source)) + local cache_path = cache_dir .. PATHSEP .. "files" .. PATHSEP .. system.hash(source) + if checksum ~= "SKIP" and system.stat(cache_path) and system.hash(cache_path, "file") ~= checksum then common.rmrf(cache_path) end local res if not system.stat(cache_path) then res, headers = system.get(protocol, hostname, port, rest, cache_path .. ".part", callback) -- cgit v1.2.3