Fix empty dir double-finalization and remote_item_write_id reset bugs

Agent-Logs-Url: https://github.com/kovidgoyal/kitty/sessions/24185546-c2b4-44e6-8649-a06dc6d1491d

Co-authored-by: kovidgoyal <1308621+kovidgoyal@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-05-11 17:13:34 +00:00 committed by GitHub
parent 8fbe867afb
commit 9324bd6276
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -395,7 +395,9 @@ func (dnd *dnd) send_remote_dir(path string, idx_in_uri_list, parent_dir_handle,
names = append(names, entry.Name())
}
payload := utils.UnsafeStringToBytes(strings.Join(names, "\x00"))
dnd.send_remote_item_payload(parent_dir_handle, idx, idx_in_uri_list, handle, payload)
if len(payload) > 0 {
dnd.send_remote_item_payload(parent_dir_handle, idx, idx_in_uri_list, handle, payload)
}
dnd.drag_status.remote_item_write_id = dnd.send_remote_item_payload(parent_dir_handle, idx, idx_in_uri_list, handle, nil)
return
}
@ -442,6 +444,7 @@ func (dnd *dnd) next_remote_item() (err error) {
if len(dnd.drag_status.remote_items) < 1 {
// current remote data request finished
dnd.drag_status.remote_data_requests = dnd.drag_status.remote_data_requests[1:]
dnd.drag_status.remote_item_write_id = 0
if len(dnd.drag_status.remote_data_requests) > 0 {
return dnd.send_next_remote_data_request()
}