macos: assert only one text-plain gets written to clipboard

pull/9418/head
Mitchell Hashimoto 2025-10-30 15:16:14 -07:00
parent 54fe54fe37
commit 5c1f036613
No known key found for this signature in database
GPG Key ID: 523D5DC389D273BC
1 changed files with 5 additions and 0 deletions

View File

@ -383,6 +383,11 @@ extension Ghostty {
}
guard !contentArray.isEmpty else { return }
// Assert there is only one text/plain entry. For security reasons we need
// to guarantee this for now since our confirmation dialog only shows one.
assert(contentArray.filter({ $0.mime == "text/plain" }).count <= 1,
"clipboard contents should have at most one text/plain entry")
if !confirm {
// Declare all types
let types = contentArray.compactMap { item in