dnd.c: strip query and fragment parts from file:// URLs before path resolution

Agent-Logs-Url: https://github.com/kovidgoyal/kitty/sessions/8293fefc-4d7c-4502-9646-6270328d4a59

Co-authored-by: kovidgoyal <1308621+kovidgoyal@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-04-02 03:19:41 +00:00 committed by GitHub
parent eff590ab5a
commit 087c5c1db9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 0 deletions

View file

@ -183,6 +183,8 @@ Detailed list of changes
- :doc:`Remote control <remote-control>`: Expose :code:`session_name` in the output of ``kitten @ ls`` for each window (:iss:`9732`)
- Drag and drop: Ignore query and fragment parts of ``file://`` URLs when parsing dropped file paths
- Fix thickness of diagonal lines in box drawing characters not the same as horizontal/vertical lines (:iss:`9719`)
- Graphics protocol: Fix crash when handling invalid PNG image with direct transmission

View file

@ -488,6 +488,9 @@ get_nth_file_url(const char *uri_list, size_t uri_list_sz, int n, char **path_ou
RAII_ALLOC(char, path, strdup(slash));
if (!path) { *error_out = "ENOMEM"; return false; }
/* Strip any query (?...) or fragment (#...) from the path */
char *query_or_fragment_start = path + strcspn(path, "?#");
*query_or_fragment_start = 0;
url_decode_inplace(path);
if (path[0] != '/') { *error_out = "EINVAL"; return false; }