fix: follow symlinks when detecting mime-type on Windows (#527)

This commit is contained in:
三咲雅 · Misaki Masa 2024-01-19 01:00:57 +08:00 committed by GitHub
parent e987855fca
commit 453ca94e18
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -6,14 +6,7 @@ function M:preload()
urls[#urls + 1] = tostring(file.url)
end
local args
if ya.target_family() == "windows" then
args = { "-b", "--mime-type" }
else
args = { "-b", "-L", "--mime-type" }
end
local child, code = Command("file"):args(args):args(urls):stdout(Command.PIPED):spawn()
local child, code = Command("file"):args({ "-bL", "--mime-type" }):args(urls):stdout(Command.PIPED):spawn()
if not child then
ya.err("spawn `file` command returns " .. tostring(code))
return 0