wayland: Fix drag and drop for paths with spaces (#14574)

This wasn't doing any proper parsing before, so `%20` or similar encoded
characters weren't handled correctly.

Release Notes:

- N/A
This commit is contained in:
apricotbucket28 2024-07-16 14:42:57 -03:00 committed by GitHub
parent 400ae9c650
commit 09459fa3a4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -11,6 +11,7 @@ use calloop_wayland_source::WaylandSource;
use collections::HashMap;
use filedescriptor::Pipe;
use http::Url;
use smallvec::SmallVec;
use util::ResultExt;
use wayland_backend::client::ObjectId;
@ -1795,7 +1796,8 @@ impl Dispatch<wl_data_device::WlDataDevice, ()> for WaylandClientStatePtr {
let paths: SmallVec<[_; 2]> = file_list
.lines()
.map(|path| PathBuf::from(path.replace("file://", "")))
.filter_map(|path| Url::parse(path).log_err())
.filter_map(|url| url.to_file_path().log_err())
.collect();
let position = Point::new(x.into(), y.into());