feat: prevent paths from being treated as options in file command (#1783)

This commit is contained in:
gaesa 2024-10-14 16:44:31 +00:00 committed by GitHub
parent 1acd7ca80f
commit 3e8ac856cf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View file

@ -2,7 +2,7 @@ local M = {}
function M:peek()
local cmd = os.getenv("YAZI_FILE_ONE") or "file"
local output, code = Command(cmd):args({ "-bL", tostring(self.file.url) }):stdout(Command.PIPED):output()
local output, code = Command(cmd):args({ "-bL", "--", tostring(self.file.url) }):stdout(Command.PIPED):output()
local text
if output then

View file

@ -16,7 +16,7 @@ function M:fetch()
end
local cmd = os.getenv("YAZI_FILE_ONE") or "file"
local child, code = Command(cmd):args({ "-bL", "--mime-type" }):args(urls):stdout(Command.PIPED):spawn()
local child, code = Command(cmd):args({ "-bL", "--mime-type", "--" }):args(urls):stdout(Command.PIPED):spawn()
if not child then
ya.err(string.format("Spawn `%s` command returns %s", cmd, code))
return 0