Skip to content

Commit 815cf4c

Browse files
prefrontalsysclaude
andcommitted
Fix: filter empty strings in sync auth status check
disconnect_cloud_sync sets sync_gist_id to "" rather than deleting it. Since get_setting returns Some("") for empty values, the is_authenticated check (token.is_some() && gist_id.is_some()) incorrectly returns true after disconnect. Add .filter(|s| !s.is_empty()) to all get_setting calls in get_sync_auth_status, matching the pattern already used in get_sync_status. Relates to #195 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 14c9600 commit 815cf4c

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src-tauri/src/commands/cloud_sync.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,10 @@ pub async fn connect_cloud_sync(
109109
#[tauri::command]
110110
pub fn get_sync_auth_status(db: State<'_, Arc<Mutex<Database>>>) -> Result<SyncAuthStatus, String> {
111111
let db = db.lock().map_err(|e| e.to_string())?;
112-
let token = db.get_setting("github_token");
113-
let username = db.get_setting("sync_username");
114-
let gist_id = db.get_setting("sync_gist_id");
115-
let gist_url = db.get_setting("sync_gist_url");
112+
let token = db.get_setting("github_token").filter(|s| !s.is_empty());
113+
let username = db.get_setting("sync_username").filter(|s| !s.is_empty());
114+
let gist_id = db.get_setting("sync_gist_id").filter(|s| !s.is_empty());
115+
let gist_url = db.get_setting("sync_gist_url").filter(|s| !s.is_empty());
116116
let has_gh = has_gh_cli();
117117

118118
Ok(SyncAuthStatus {

0 commit comments

Comments
 (0)