fix(trust): :trust command on Windows #36509

`:trust` command calculated SHA-256 on file content reading it as a
text. While it doesn't matter on Unices, on Windows hash was calculated
incorectly. SHA-256 for buffer content was calculated fine though.

After this fix hashes in `%LOCALAPPDATA%/nvim-data/trust` are the same
as in output of `sha256sum -t`.
This commit is contained in:
Andrey Starodubtsev
2025-11-12 07:57:09 +02:00
committed by GitHub
parent 653871da1b
commit b15b22fc73

View File

@@ -47,7 +47,7 @@ local function compute_hash(fullpath, bufnr)
end
else
do
local f = io.open(fullpath, 'r')
local f = io.open(fullpath, 'rb')
if not f then
return nil, nil
end