From 184065085cb8a6d7dfa411b714f52b73a35a987e Mon Sep 17 00:00:00 2001 From: UnnaturalTwilight <107954129+UnnaturalTwilight@users.noreply.github.com> Date: Wed, 1 Jul 2026 10:42:16 -0400 Subject: [PATCH] Changelog and fix payload size limit to be per mime type --- CHANGELOG.md | 2 ++ yazi-term/src/parser/osc.rs | 12 ++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 09209fa6..e13ed3c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/): - Show file icons in trash/delete/overwrite confirmations ([#4096]) - Dynamic keymap Lua API ([#4031]) - New `ui.Input` element ([#4040]) +- Copying and pasting files with the system clipboard ([#4035]) - Image preview with Überzug++ on Niri ([#3990]) - New gait for input `backward` and `forward` actions ([#4012]) @@ -1768,6 +1769,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/): [#4012]: https://github.com/sxyazi/yazi/pull/4012 [#4022]: https://github.com/sxyazi/yazi/pull/4022 [#4031]: https://github.com/sxyazi/yazi/pull/4031 +[#4035]: https://github.com/sxyazi/yazi/pull/4035 [#4040]: https://github.com/sxyazi/yazi/pull/4040 [#4064]: https://github.com/sxyazi/yazi/pull/4064 [#4065]: https://github.com/sxyazi/yazi/pull/4065 diff --git a/yazi-term/src/parser/osc.rs b/yazi-term/src/parser/osc.rs index 08dc8f12..4ae96e69 100644 --- a/yazi-term/src/parser/osc.rs +++ b/yazi-term/src/parser/osc.rs @@ -90,18 +90,18 @@ impl Parser { // decode now since each payload may have its own padding let payload = BASE64_PAD.decode(&payload).or(Err(ParseError::Invalid))?; - // Limit payload size to 1MiB to prevent potential DoS - // TODO A larger size would be required for directly pasting images/large files - if state.payload.len() + payload.len() > 1 << 20 { - return Err(ParseError::Invalid); - } - if state.idx >= state.payload.len() { state.payload.push(payload.to_vec()); } else { state.payload[state.idx].extend(payload); } + // Limit payload size to 1MiB per mime type to prevent potential DoS + // TODO A larger size would be required for directly pasting images/large files + if state.payload[state.idx].len() > 1 << 20 { + return Err(ParseError::Invalid); + } + Ok(()) } }