authorgravatar for git@paperclover.netclover caruso <git@paperclover.net> 2026-10-01 16:02:58-07:00
committergravatar for git@paperclover.netclover caruso <git@paperclover.net> 2026-10-01 16:46:24-07:00
log1277556627697178524b047acc28e6d3694f31e9
tree854caadaeca383dfe7bd7e9580ddbd696d491b2c
parented9fa1dfef1a45353ef91324558faf063a170d53
signature Signed by SSH key SHA256:52mNGHRsVFBDED9IAX5pe+LRWUefqTbxEReunq21QvU

fix: Linux pastes files copied from GNOME apps

text/uri-list ends each line in CRLF; arboard splits at LF and kept the CR in the path, so a picture copied in Loupe or a file copied in Files pasted as "Couldn't attach the file". Assisted-by: claude-opus-5.5

1 files changed, 9 insertions(+), 2 deletions(-)

crates/snowbound/src/linux.rs+9-2
......@@ -233,8 +233,15 @@ impl Clipboard {
233233 }
234234
235235 pub fn get_files(&mut self) -> Vec<std::path::PathBuf> {
236 self.through_x11(|clipboard| clipboard.get().file_list().ok())
237 .unwrap_or_default()
236 use std::os::unix::ffi::OsStrExt;
237 let files = self.through_x11(|clipboard| clipboard.get().file_list().ok());
238 // arboard splits text/uri-list at LF and keeps the CR its CRLF lines end in.
239 let path = |path: std::path::PathBuf| {
240 let bytes = path.as_os_str().as_bytes();
241 let bytes = bytes.strip_suffix(b"\r").unwrap_or(bytes);
242 std::ffi::OsStr::from_bytes(bytes).into()
243 };
244 files.unwrap_or_default().into_iter().map(path).collect()
238245 }
239246
240247 pub fn get_html(&mut self) -> Option<String> {