From b19356ac69637dfff8cd4e1c7a05490f02f54570 Mon Sep 17 00:00:00 2001 From: apricotbucket28 <71973804+apricotbucket28@users.noreply.github.com> Date: Thu, 22 Aug 2024 18:43:02 -0300 Subject: [PATCH] linux: Ignore benign error when cancelling file picker (#15553) Fixes https://github.com/zed-industries/zed/issues/15485 This should be clearer on the `ashpd` side, but `ResponseError` comes from the portal [Response](https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.Request.html#org-freedesktop-portal-request-response), which means the request itself didn't fail. Ignoring the `Other` variant here should be safe. Release Notes: - Linux: Fixed benign error being shown when cancelling file picker ([#15485](https://github.com/zed-industries/zed/issues/15485)) --- crates/gpui/src/platform/linux/platform.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/crates/gpui/src/platform/linux/platform.rs b/crates/gpui/src/platform/linux/platform.rs index 1185c783be..3d7f8c2adc 100644 --- a/crates/gpui/src/platform/linux/platform.rs +++ b/crates/gpui/src/platform/linux/platform.rs @@ -21,7 +21,6 @@ use std::{ use anyhow::anyhow; use ashpd::desktop::file_chooser::{OpenFileRequest, SaveFileRequest}; use ashpd::desktop::open_uri::{OpenDirectoryRequest, OpenFileRequest as OpenUriRequest}; -use ashpd::desktop::ResponseError; use ashpd::{url, ActivationToken}; use async_task::Runnable; use calloop::channel::Channel; @@ -300,7 +299,7 @@ impl Platform for P { .filter_map(|uri| uri.to_file_path().ok()) .collect::>(), )), - Err(ashpd::Error::Response(ResponseError::Cancelled)) => Ok(None), + Err(ashpd::Error::Response(_)) => Ok(None), Err(e) => Err(e.into()), }; done_tx.send(result); @@ -338,7 +337,7 @@ impl Platform for P { .uris() .first() .and_then(|uri| uri.to_file_path().ok())), - Err(ashpd::Error::Response(ResponseError::Cancelled)) => Ok(None), + Err(ashpd::Error::Response(_)) => Ok(None), Err(e) => Err(e.into()), }; done_tx.send(result);