diff --git a/docs/changelog.rst b/docs/changelog.rst index 92e8306b7..416b4ac02 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -183,6 +183,8 @@ Detailed list of changes - :doc:`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 diff --git a/kitty/dnd.c b/kitty/dnd.c index 3989f36f2..2b2d5fbd2 100644 --- a/kitty/dnd.c +++ b/kitty/dnd.c @@ -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; }