fix(auth): refresh tokens before authenticated requests
Move token refresh checks into the shared Rust connection/API path so long-running authenticated operations stop reusing stale access tokens. This covers recursive download and upload traversal, recursive ls via the shared APIs, and direct authenticated commands such as cp, mv, rm, and chacl. Also surface HTTP failures earlier in the affected API methods instead of failing later during response parsing. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Vendored
+3
-1
@@ -168,5 +168,7 @@ pub fn create_authenticated_conn(
|
||||
) -> Result<MDRSConnection, anyhow::Error> {
|
||||
let url = crate::commands::config::get_remote_url(remote)?
|
||||
.ok_or_else(|| anyhow!("Remote `{}` is not configured.", remote))?;
|
||||
Ok(MDRSConnection::new(&url).with_token(cache.token.access.clone()))
|
||||
Ok(MDRSConnection::new(&url)
|
||||
.with_remote(remote)
|
||||
.with_token(cache.token.access.clone()))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user