mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-09 21:55:29 +02:00
When dragging an empty file (or a directory containing an empty file) from a remote Linux machine to macOS Finder, the empty file would not be copied. Root cause: in add_payload() in dnd.c, the file is only created with O_CREAT when payload data arrives. For an empty file, no payload is ever sent, so the file was never created on disk. When Finder then tried to hard-link the (non-existent) temp file to the destination, it failed silently. Fix: in the "all data received" handler for type 0 (regular file), check if the fd was ever opened. If not (empty file), create the empty file explicitly before finishing. Also add: - A new test probe drag_remote_item_path:N to retrieve the filesystem path of a specific remote item by URI index. - Two regression tests: test_remote_drag_empty_file (verifying the empty file is created on disk) and test_remote_drag_dir_with_empty_file (verifying an empty child file inside a directory is created on disk). Agent-Logs-Url: https://github.com/kovidgoyal/kitty/sessions/da8b4577-3de8-4784-afc0-c1967f605dec Co-authored-by: kovidgoyal <1308621+kovidgoyal@users.noreply.github.com>