From 80b656003033661348a58100c8ca35dd5475d72c Mon Sep 17 00:00:00 2001 From: Yoshihiro OKUMURA Date: Thu, 11 Jun 2026 21:04:25 +0900 Subject: [PATCH] feat(download): allow anonymous download of public data --- src/commands/download.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/commands/download.rs b/src/commands/download.rs index d7a202d..c674770 100644 --- a/src/commands/download.rs +++ b/src/commands/download.rs @@ -1,6 +1,6 @@ -use crate::cache::{create_authenticated_conn, load_cache_with_token_refresh}; +use crate::cache::create_readonly_conn; use crate::commands::shared::{ - find_file_by_name, find_folder_limited, find_lab_in_cache, find_subfolder_by_name, + find_file_by_name, find_folder_limited, find_laboratory, find_subfolder_by_name, parse_remote_path, }; use crate::connection::{ApiRequestLimiter, MDRSConnection}; @@ -18,10 +18,10 @@ pub async fn download( excludes: Vec, ) -> Result<(), anyhow::Error> { let (remote, labname, r_path) = parse_remote_path(remote_path)?; - let cache = load_cache_with_token_refresh(&remote).await?; - let conn = Arc::new(create_authenticated_conn(&remote, &cache)?); + let (conn, cache) = create_readonly_conn(&remote).await?; + let conn = Arc::new(conn); let limiter = ApiRequestLimiter::new(crate::settings::SETTINGS.concurrent); - let lab = find_lab_in_cache(&cache, &labname)?; + let lab = find_laboratory(&conn, cache.as_ref(), &labname).await?; // Validate that local_path is an existing directory (matching Python's behaviour). let local_real = std::fs::canonicalize(local_path)