feat(download): allow anonymous download of public data
This commit is contained in:
@@ -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<String>,
|
||||
) -> 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)
|
||||
|
||||
Reference in New Issue
Block a user