diff --git a/src/commands/list.rs b/src/commands/list.rs index b3041e5..369949c 100644 --- a/src/commands/list.rs +++ b/src/commands/list.rs @@ -698,7 +698,7 @@ impl SqliteClipboardDb { let mime_type = match mime { Some(ref m) if m == "text/plain" => MimeType::Text, Some(ref m) => MimeType::Specific(m.clone().clone()), - None => MimeType::Text, + None => MimeType::Autodetect, }; let copy_result = opts .copy(Source::Bytes(contents.clone().into()), mime_type); diff --git a/src/commands/watch.rs b/src/commands/watch.rs index 71cdc17..111a330 100644 --- a/src/commands/watch.rs +++ b/src/commands/watch.rs @@ -435,6 +435,14 @@ impl WatchCommand for SqliteClipboardDb { log::info!("clipboard entry excluded by app filter"); last_hash = Some(current_hash); }, + Err(crate::db::StashError::AllWhitespace) => { + log::debug!("clipboard entry is all whitespace, skipping"); + last_hash = Some(current_hash); + }, + Err(crate::db::StashError::TooSmall(_)) => { + log::debug!("clipboard entry below minimum size, skipping"); + last_hash = Some(current_hash); + }, Err(e) => { log::error!("failed to store clipboard entry: {e}"); last_hash = Some(current_hash); @@ -518,8 +526,8 @@ mod tests { #[test] fn test_pick_image_preference_falls_back() { + // No image types in offer set; first type is used as fallback. let offered = vec!["text/html".to_string(), "text/plain".to_string()]; - // No image types offered — falls back to first assert_eq!(pick_mime(&offered, "image").unwrap(), "text/html"); } @@ -550,14 +558,14 @@ mod tests { #[test] fn test_pick_html_fallback_when_only_html() { - // When text/html is the only type, pick it + // text/html is used when it is the only offered type. let offered = vec!["text/html".to_string()]; assert_eq!(pick_mime(&offered, "any").unwrap(), "text/html"); } #[test] fn test_pick_text_over_html_when_no_image() { - // Rich text copy: html + plain, no image — prefer plain text + // html + plain with no image type; plain text wins over html. let offered = vec!["text/html".to_string(), "text/plain".to_string()]; assert_eq!(pick_mime(&offered, "any").unwrap(), "text/plain"); }