diff options
author | Adam Harrison <adamdharrison@gmail.com> | 2024-03-08 14:54:05 -0500 |
---|---|---|
committer | Adam Harrison <adamdharrison@gmail.com> | 2024-03-08 14:54:05 -0500 |
commit | 92b11ba74e29088504ffe27d40c603e0c84b71ef (patch) | |
tree | c31a5bb26a324b75a1401e5b942fc5f57509eb1a | |
parent | ae5b41ef19ac9cc806b749821c0881aac177f3c6 (diff) | |
download | lite-xl-plugin-manager-92b11ba74e29088504ffe27d40c603e0c84b71ef.tar.gz lite-xl-plugin-manager-92b11ba74e29088504ffe27d40c603e0c84b71ef.zip |
Remove files that don't match checksums.
-rw-r--r-- | src/lpm.lua | 3 |
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) |