mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
fix: prevent quotes in file(1) arguments from being stripped under MSYS2 (#3364)
This commit is contained in:
parent
c725c91df1
commit
2d55c9427d
6 changed files with 54 additions and 12 deletions
|
|
@ -73,6 +73,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/):
|
||||||
- Force Git checkout for plugin cache repositories ([#3169])
|
- Force Git checkout for plugin cache repositories ([#3169])
|
||||||
- Check compatibility when reusing previewer bytecode cache ([#3190])
|
- Check compatibility when reusing previewer bytecode cache ([#3190])
|
||||||
- Disable kitty keyboard protocol on Windows due to `crossterm` inability to handle it ([#3250])
|
- Disable kitty keyboard protocol on Windows due to `crossterm` inability to handle it ([#3250])
|
||||||
|
- Prevent quotes in file(1) arguments from being stripped under MSYS2 ([#3364])
|
||||||
- Expose `ya` CLI in the Snap build ([#2904])
|
- Expose `ya` CLI in the Snap build ([#2904])
|
||||||
- Fallback to `PollWatcher` for file changes watching on NetBSD ([#2941])
|
- Fallback to `PollWatcher` for file changes watching on NetBSD ([#2941])
|
||||||
- Generate unique image IDs for Kgp to tolerate tmux ([#3038])
|
- Generate unique image IDs for Kgp to tolerate tmux ([#3038])
|
||||||
|
|
@ -1540,3 +1541,4 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/):
|
||||||
[#3313]: https://github.com/sxyazi/yazi/pull/3313
|
[#3313]: https://github.com/sxyazi/yazi/pull/3313
|
||||||
[#3317]: https://github.com/sxyazi/yazi/pull/3317
|
[#3317]: https://github.com/sxyazi/yazi/pull/3317
|
||||||
[#3360]: https://github.com/sxyazi/yazi/pull/3360
|
[#3360]: https://github.com/sxyazi/yazi/pull/3360
|
||||||
|
[#3364]: https://github.com/sxyazi/yazi/pull/3364
|
||||||
|
|
|
||||||
17
Cargo.lock
generated
17
Cargo.lock
generated
|
|
@ -2123,15 +2123,16 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mlua"
|
name = "mlua"
|
||||||
version = "0.11.4"
|
version = "0.11.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9be1c2bfc684b8a228fbaebf954af7a47a98ec27721986654a4cc2c40a20cc7e"
|
checksum = "935ac67539907efcd7198137eb7358e052555f77fe1b2916600a2249351f2b33"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"bstr",
|
"bstr",
|
||||||
"either",
|
"either",
|
||||||
"erased-serde",
|
"erased-serde",
|
||||||
"futures-util",
|
"futures-util",
|
||||||
|
"libc",
|
||||||
"mlua-sys",
|
"mlua-sys",
|
||||||
"mlua_derive",
|
"mlua_derive",
|
||||||
"num-traits",
|
"num-traits",
|
||||||
|
|
@ -2144,9 +2145,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mlua-sys"
|
name = "mlua-sys"
|
||||||
version = "0.8.3"
|
version = "0.9.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3d4dc9cfc5a7698899802e97480617d9726f7da78c910db989d4d0fd4991d900"
|
checksum = "8c968af21bf6b19fc9ca8e7b85ee16f86e4c9e3d0591de101a5608086bda0ad8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cc",
|
"cc",
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
|
|
@ -5173,18 +5174,18 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zerocopy"
|
name = "zerocopy"
|
||||||
version = "0.8.28"
|
version = "0.8.30"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "43fa6694ed34d6e57407afbccdeecfa268c470a7d2a5b0cf49ce9fcc345afb90"
|
checksum = "4ea879c944afe8a2b25fef16bb4ba234f47c694565e97383b36f3a878219065c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"zerocopy-derive",
|
"zerocopy-derive",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zerocopy-derive"
|
name = "zerocopy-derive"
|
||||||
version = "0.8.28"
|
version = "0.8.30"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c640b22cd9817fae95be82f0d2f90b11f7605f6c319d16705c459b27ac2cbc26"
|
checksum = "cf955aa904d6040f70dc8e9384444cb1030aed272ba3cb09bbc4ab9e7c1f34f5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ hashbrown = { version = "0.16.1", features = [ "serde" ] }
|
||||||
indexmap = { version = "2.12.1", features = [ "serde" ] }
|
indexmap = { version = "2.12.1", features = [ "serde" ] }
|
||||||
libc = "0.2.177"
|
libc = "0.2.177"
|
||||||
lru = "0.16.2"
|
lru = "0.16.2"
|
||||||
mlua = { version = "0.11.4", features = [ "anyhow", "async", "error-send", "lua54", "macros", "serde" ] }
|
mlua = { version = "0.11.5", features = [ "anyhow", "async", "error-send", "lua54", "macros", "serde" ] }
|
||||||
objc2 = "0.6.3"
|
objc2 = "0.6.3"
|
||||||
ordered-float = { version = "5.1.0", features = [ "serde" ] }
|
ordered-float = { version = "5.1.0", features = [ "serde" ] }
|
||||||
parking_lot = "0.12.5"
|
parking_lot = "0.12.5"
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,29 @@ local function match_mimetype(line)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function spawn_file1(paths)
|
||||||
|
local bin = os.getenv("YAZI_FILE_ONE") or "file"
|
||||||
|
local windows = ya.target_family() == "windows"
|
||||||
|
|
||||||
|
local cmd = Command(bin):arg({ "-bL", "--mime-type" }):stdout(Command.PIPED)
|
||||||
|
if windows then
|
||||||
|
cmd:arg({ "-f", "-" }):stdin(Command.PIPED)
|
||||||
|
else
|
||||||
|
cmd:arg("--"):arg(paths)
|
||||||
|
end
|
||||||
|
|
||||||
|
local child, err = cmd:spawn()
|
||||||
|
if not child then
|
||||||
|
return nil, Err("Failed to start `%s`, error: %s", bin, err)
|
||||||
|
elseif windows then
|
||||||
|
child:write_all(table.concat(paths, "\n"))
|
||||||
|
child:flush()
|
||||||
|
ya.drop(child:take_stdin())
|
||||||
|
end
|
||||||
|
|
||||||
|
return child
|
||||||
|
end
|
||||||
|
|
||||||
function M:fetch(job)
|
function M:fetch(job)
|
||||||
local urls, paths = {}, {}
|
local urls, paths = {}, {}
|
||||||
for i, file in ipairs(job.files) do
|
for i, file in ipairs(job.files) do
|
||||||
|
|
@ -25,10 +48,9 @@ function M:fetch(job)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local cmd = os.getenv("YAZI_FILE_ONE") or "file"
|
local child, err = spawn_file1(paths)
|
||||||
local child, err = Command(cmd):arg({ "-bL", "--mime-type", "--" }):arg(paths):stdout(Command.PIPED):spawn()
|
|
||||||
if not child then
|
if not child then
|
||||||
return true, Err("Failed to start `%s`, error: %s", cmd, err)
|
return true, err
|
||||||
end
|
end
|
||||||
|
|
||||||
local updates, last = {}, ya.time()
|
local updates, last = {}, ya.time()
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,7 @@
|
||||||
|
use std::any::TypeId;
|
||||||
|
|
||||||
use mlua::{AnyUserData, ExternalError, Function, Lua};
|
use mlua::{AnyUserData, ExternalError, Function, Lua};
|
||||||
|
use tokio::process::{ChildStderr, ChildStdin, ChildStdout};
|
||||||
use yazi_binding::{Id, Permit, PermitRef, deprecate};
|
use yazi_binding::{Id, Permit, PermitRef, deprecate};
|
||||||
use yazi_proxy::{AppProxy, HIDER};
|
use yazi_proxy::{AppProxy, HIDER};
|
||||||
|
|
||||||
|
|
@ -15,6 +18,19 @@ impl Utils {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(super) fn drop(lua: &Lua) -> mlua::Result<Function> {
|
||||||
|
lua.create_function(|_, ud: AnyUserData| {
|
||||||
|
match ud.type_id() {
|
||||||
|
Some(t) if t == TypeId::of::<ChildStdin>() => {}
|
||||||
|
Some(t) if t == TypeId::of::<ChildStdout>() => {}
|
||||||
|
Some(t) if t == TypeId::of::<ChildStderr>() => {}
|
||||||
|
Some(t) => Err(format!("Cannot drop userdata of type {t:?}").into_lua_err())?,
|
||||||
|
None => Err("Cannot drop scoped userdata".into_lua_err())?,
|
||||||
|
};
|
||||||
|
ud.destroy()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
pub(super) fn hide(lua: &Lua) -> mlua::Result<Function> {
|
pub(super) fn hide(lua: &Lua) -> mlua::Result<Function> {
|
||||||
lua.create_async_function(|lua, ()| async move {
|
lua.create_async_function(|lua, ()| async move {
|
||||||
deprecate!(lua, "`ya.hide()` is deprecated, use `ui.hide()` instead, in your {}\nSee #2939 for more details: https://github.com/sxyazi/yazi/pull/2939");
|
deprecate!(lua, "`ya.hide()` is deprecated, use `ui.hide()` instead, in your {}\nSee #2939 for more details: https://github.com/sxyazi/yazi/pull/2939");
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ pub fn compose(
|
||||||
match key {
|
match key {
|
||||||
// App
|
// App
|
||||||
b"id" => Utils::id(lua)?,
|
b"id" => Utils::id(lua)?,
|
||||||
|
b"drop" => Utils::drop(lua)?,
|
||||||
b"hide" => Utils::hide(lua)?,
|
b"hide" => Utils::hide(lua)?,
|
||||||
|
|
||||||
// Cache
|
// Cache
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue