Repository navigation
Desktop: Update winit to include window dragging fix for Windows - #4550
Conversation
|
!build desktop (Run ID 35411371824) |
|
|
|
4415484 to
73f72f5
Compare
73f72f5 to
8bbb7bf
Compare
There was a problem hiding this comment.
1 issue found across 2 reviewed files. 1 file intentionally excluded from review.
Confidence score: 4/5
- In
desktop/src/app.rs, thefilter_mapcan silently discard URIs when parsing or converting to a file path fails, unlike the explicit error branches; this may make some inputs appear to be ignored without feedback. Add explicit reporting or handling for dropped URIs.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="desktop/src/app.rs">
<violation number="1" location="desktop/src/app.rs:662">
P2: The filter_map silently drops every URI that fails Url::parse or to_file_path, without any error message of its own, while the match's Err branches log errors. A dropped item that isn't a local file:// URL — including `file://` URLs with a host component (UNC paths like `file://server/share/...`), which to_file_path rejects — is skipped with no diagnostic, so a multi-file drop imports partially (or not at all) with no way for the user or logs to see why. Log each discarded URI so silent import failures are diagnosable.</violation>
</file>
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
| WindowEvent::DataTransferReceived { serial, ref value, .. } if self.pending_dnd_fetch == Some(serial) => match value.try_as_uris() { | ||
| Ok(uris) => { | ||
| self.pending_dnd_fetch = None; | ||
| let paths = uris.iter().filter_map(|uri| url::Url::parse(uri).ok()?.to_file_path().ok()); |
There was a problem hiding this comment.
P2: The filter_map silently drops every URI that fails Url::parse or to_file_path, without any error message of its own, while the match's Err branches log errors. A dropped item that isn't a local file:// URL — including file:// URLs with a host component (UNC paths like file://server/share/...), which to_file_path rejects — is skipped with no diagnostic, so a multi-file drop imports partially (or not at all) with no way for the user or logs to see why. Log each discarded URI so silent import failures are diagnosable.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At desktop/src/app.rs, line 662:
<comment>The filter_map silently drops every URI that fails Url::parse or to_file_path, without any error message of its own, while the match's Err branches log errors. A dropped item that isn't a local file:// URL — including `file://` URLs with a host component (UNC paths like `file://server/share/...`), which to_file_path rejects — is skipped with no diagnostic, so a multi-file drop imports partially (or not at all) with no way for the user or logs to see why. Log each discarded URI so silent import failures are diagnosable.</comment>
<file context>
@@ -656,9 +656,10 @@ impl ApplicationHandler for App {
+ WindowEvent::DataTransferReceived { serial, ref value, .. } if self.pending_dnd_fetch == Some(serial) => match value.try_as_uris() {
+ Ok(uris) => {
self.pending_dnd_fetch = None;
+ let paths = uris.iter().filter_map(|uri| url::Url::parse(uri).ok()?.to_file_path().ok());
for path in paths {
match fs::read(&path) {
</file context>
| let paths = uris.iter().filter_map(|uri| url::Url::parse(uri).ok()?.to_file_path().ok()); | |
| let paths = uris | |
| .iter() | |
| .filter_map(|uri| match url::Url::parse(uri).ok().and_then(|url| url.to_file_path().ok()) { | |
| Some(path) => Some(path), | |
| None => { | |
| tracing::warn!("Ignoring dropped item that is not a local file URL: {uri}"); | |
| None | |
| } | |
| }) | |
| .collect::<Vec<_>>(); |
|
!build desktop (Run ID 35444328203) |
|
|
|
Update winit to include rust-windowing/winit#4700.