From 1277556627697178524b047acc28e6d3694f31e9 Mon Sep 17 00:00:00 2001 From: clover caruso Date: Thu, 1 Oct 2026 16:02:58 -0700 Subject: [PATCH] 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 --- crates/snowbound/src/linux.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/crates/snowbound/src/linux.rs b/crates/snowbound/src/linux.rs index bbe2d93e62a6b9259950ab4869787cf66f462a41..7522c11e7b5890508cf016bcab25686c63a7cd49 100644 --- a/crates/snowbound/src/linux.rs +++ b/crates/snowbound/src/linux.rs @@ -233,8 +233,15 @@ impl Clipboard { } pub fn get_files(&mut self) -> Vec { - self.through_x11(|clipboard| clipboard.get().file_list().ok()) - .unwrap_or_default() + use std::os::unix::ffi::OsStrExt; + let files = self.through_x11(|clipboard| clipboard.get().file_list().ok()); + // arboard splits text/uri-list at LF and keeps the CR its CRLF lines end in. + let path = |path: std::path::PathBuf| { + let bytes = path.as_os_str().as_bytes(); + let bytes = bytes.strip_suffix(b"\r").unwrap_or(bytes); + std::ffi::OsStr::from_bytes(bytes).into() + }; + files.unwrap_or_default().into_iter().map(path).collect() } pub fn get_html(&mut self) -> Option { -- 2.54.0