From 6efa4f10bebb277494409e9773539c4de0ff9e2d Mon Sep 17 00:00:00 2001 From: Chen Mulong Date: Tue, 20 May 2025 21:34:20 +0800 Subject: [PATCH] Fix behaviour change for wayland If the mime-type doesn't exist, the process should exit with 0. --- src/clipboard/wayland.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/clipboard/wayland.rs b/src/clipboard/wayland.rs index 34d4358..82edebe 100644 --- a/src/clipboard/wayland.rs +++ b/src/clipboard/wayland.rs @@ -111,10 +111,12 @@ fn paste_wayland(cfg: PasteConfig) -> Result<()> { return Ok(()); } - let mime_type = CString::new(decide_mime_type( - &state.config.expected_mime_type, - supported_types, - )?)?; + let mime_type = + if let Ok(type_str) = decide_mime_type(&state.config.expected_mime_type, supported_types) { + CString::new(type_str)? + } else { + return Ok(()); + }; // offer.receive needs a fd to write, we cannot use the stdin since the read side of the // pipe may close earlier before all data written.