Skip to content

Commit dc38d3e

Browse files
Merge pull request #191 from ylxdzsw/patch-1
Fix dbus service algorithm fallback
2 parents 381666b + 013e17b commit dc38d3e

3 files changed

Lines changed: 11 additions & 8 deletions

File tree

client/src/dbus/error.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub enum ServiceError {
2020
#[derive(Debug)]
2121
pub enum Error {
2222
/// Something went wrong on the wire.
23-
Zbus(zbus::Error),
23+
ZBus(zbus::Error),
2424
/// A service error.
2525
Service(ServiceError),
2626
/// The item/collection was removed.
@@ -39,19 +39,19 @@ pub enum Error {
3939

4040
impl From<zbus::Error> for Error {
4141
fn from(e: zbus::Error) -> Self {
42-
Self::Zbus(e)
42+
Self::ZBus(e)
4343
}
4444
}
4545

4646
impl From<zbus::fdo::Error> for Error {
4747
fn from(e: zbus::fdo::Error) -> Self {
48-
Self::Zbus(zbus::Error::FDO(Box::new(e)))
48+
Self::ZBus(zbus::Error::FDO(Box::new(e)))
4949
}
5050
}
5151

5252
impl From<zbus::zvariant::Error> for Error {
5353
fn from(e: zbus::zvariant::Error) -> Self {
54-
Self::Zbus(zbus::Error::Variant(e))
54+
Self::ZBus(zbus::Error::Variant(e))
5555
}
5656
}
5757

@@ -84,7 +84,7 @@ impl std::error::Error for Error {}
8484
impl fmt::Display for Error {
8585
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
8686
match self {
87-
Self::Zbus(err) => write!(f, "zbus error {err}"),
87+
Self::ZBus(err) => write!(f, "zbus error {err}"),
8888
Self::Service(err) => write!(f, "service error {err}"),
8989
Self::IO(err) => write!(f, "IO error {err}"),
9090
Self::Deleted => write!(f, "Item/Collection was deleted, can no longer be used"),

client/src/dbus/service.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use ashpd::WindowIdentifier;
44
use futures_util::{Stream, StreamExt};
55
use zbus::zvariant::OwnedObjectPath;
66

7-
use super::{api, Algorithm, Collection, Error};
7+
use super::{api, Algorithm, Collection, Error, ServiceError};
88
use crate::Key;
99

1010
/// The entry point of communicating with a [`org.freedesktop.Secrets`](https://specifications.freedesktop.org/secret-service-spec/latest/index.html) implementation.
@@ -51,7 +51,10 @@ impl<'a> Service<'a> {
5151
pub async fn new() -> Result<Service<'a>, Error> {
5252
let service = match Self::encrypted().await {
5353
Ok(service) => Ok(service),
54-
Err(Error::Zbus(zbus::Error::MethodError(_, _, _))) => Self::plain().await,
54+
Err(Error::ZBus(zbus::Error::MethodError(..))) => Self::plain().await,
55+
Err(Error::Service(ServiceError::ZBus(zbus::Error::MethodError(..)))) => {
56+
Self::plain().await
57+
}
5558
Err(e) => Err(e),
5659
}?;
5760
Ok(service)

portal/src/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ impl From<oo7::dbus::Error> for Error {
3333

3434
impl From<oo7::zbus::Error> for Error {
3535
fn from(value: oo7::zbus::Error) -> Self {
36-
Self::Oo7(oo7::dbus::Error::Zbus(value))
36+
Self::Oo7(oo7::dbus::Error::ZBus(value))
3737
}
3838
}
3939

0 commit comments

Comments
 (0)