From 9bb90ac4c9026e74283f3c0ef920d3256ea0652b Mon Sep 17 00:00:00 2001 From: lichangze Date: Fri, 23 Aug 2024 15:39:08 +0800 Subject: [PATCH] feat: add fallback for get login.keyring path Signed-off-by: lichangze --- secret_service/secret_service.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/secret_service/secret_service.go b/secret_service/secret_service.go index 4acce61..15017d9 100644 --- a/secret_service/secret_service.go +++ b/secret_service/secret_service.go @@ -97,7 +97,13 @@ func (s *SecretService) GetCollection(name string) dbus.BusObject { func (s *SecretService) GetLoginCollection() dbus.BusObject { path := dbus.ObjectPath(collectionBasePath + "login") if err := s.CheckCollectionPath(path); err != nil { - path = dbus.ObjectPath(loginCollectionAlias) + var loginAlias dbus.ObjectPath + err := s.object.Call(serviceInterface+".ReadAlias", 0, "login").Store(&loginAlias) + if err != nil || loginAlias == "/" { + path = dbus.ObjectPath(loginCollectionAlias) + } else { + path = loginAlias + } } return s.Object(serviceName, path) }