Skip to content

Open-source download manager & offline media toolbox for YouTube, music, social media, learning platforms & 1,800+ sites. Built with Tauri 2.0, Rust & Svelte.

fix(telegram): handle DC switching in sequential download on FILE_MIGRATE error

Tonhoe63dcf8d1eb2
diff --git a/src-tauri/src/platforms/telegram/parallel_download.rs b/src-tauri/src/platforms/telegram/parallel_download.rs
index 54e7afbd..1eaf5874 100644
--- a/src-tauri/src/platforms/telegram/parallel_download.rs
+++ b/src-tauri/src/platforms/telegram/parallel_download.rs
@@ -394,13 +394,19 @@ async fn download_sequential(
limit: PART_SIZE,
};
- let response = match client.invoke_in_dc(dc, &request).await {
+ let result = if dc > 0 {
+ client.invoke_in_dc(dc, &request).await
+ } else {
+ client.invoke(&request).await
+ };
+ let response = match result {
Ok(r) => r,
Err(InvocationError::Rpc(ref err)) if err.code == FILE_MIGRATE_ERROR => {
if let Some(new_dc) = err.value {
+ let new_dc = new_dc as i32;
tracing::info!(
- "[tg-parallel] sequential FILE_MIGRATE: DC {} → DC {}",
- dc, new_dc
+ "[tg-parallel] sequential FILE_MIGRATE: switching to DC {}",
+ new_dc
);
dc = new_dc;
continue;