aboutsummaryrefslogtreecommitdiff
path: root/src/lpm.lua
diff options
context:
space:
mode:
authorAdam Harrison <adamdharrison@gmail.com>2024-03-08 14:54:05 -0500
committerAdam Harrison <adamdharrison@gmail.com>2024-03-08 14:54:05 -0500
commit92b11ba74e29088504ffe27d40c603e0c84b71ef (patch)
treec31a5bb26a324b75a1401e5b942fc5f57509eb1a /src/lpm.lua
parentae5b41ef19ac9cc806b749821c0881aac177f3c6 (diff)
downloadlite-xl-plugin-manager-92b11ba74e29088504ffe27d40c603e0c84b71ef.tar.gz
lite-xl-plugin-manager-92b11ba74e29088504ffe27d40c603e0c84b71ef.zip
Remove files that don't match checksums.
Diffstat (limited to 'src/lpm.lua')
-rw-r--r--src/lpm.lua3
1 files changed, 2 insertions, 1 deletions
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)