mirror of
https://github.com/NotAShelf/stash.git
synced 2026-04-13 06:23:47 +00:00
db: treat valid UTF-8 entries as text/plain
Makes JSON output more... servicable. Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I6a6a6964f642a02e990979f93f53a8b69764b469
This commit is contained in:
parent
f9457911ae
commit
9d0ad95e07
1 changed files with 11 additions and 1 deletions
|
|
@ -165,7 +165,17 @@ impl ClipboardDb for SqliteClipboardDb {
|
|||
return Err(StashError::AllWhitespace);
|
||||
}
|
||||
|
||||
let mime = detect_mime(&buf);
|
||||
let mime = match detect_mime(&buf) {
|
||||
None => {
|
||||
// If valid UTF-8, treat as text/plain
|
||||
if std::str::from_utf8(&buf).is_ok() {
|
||||
Some("text/plain".to_string())
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
other => other,
|
||||
};
|
||||
|
||||
self.deduplicate(&buf, max_dedupe_search)?;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue