Skip to content

Fix paste failure when clipboard contains text/uri-list with text

drcross2 requested to merge drcross2/gajim:fix/clipboard-paste-macos into master

Summary

Fixes pasting content that contains both text/uri-list and text/plain mime types, which occurs on macOS when copying hyperlinks from Safari, Notes, and other apps.

Problem

When a hyperlink is copied on macOS, the clipboard contains both text/uri-list and text/plain (with charset). Gajim sees text/uri-list first, stops the default text paste, then tries to read the clipboard as a Gdk.FileList — which fails because it's a URL, not a file. This results in a "Pasting Content Failed" error dialog and the content not being pasted.

Fix

  • When text/plain is available alongside text/uri-list, let the default TextView text paste handle it instead of trying to interpret the URL as a file transfer
  • When a FileList read does fail, fall back to reading as text instead of showing an error dialog
  • Use startswith("text/plain") to match charset variants like "text/plain;charset=utf-8"

Fixes #12620 (closed)

Merge request reports

Loading