diff --git a/uplink/src/base/bridge/actions_lane.rs b/uplink/src/base/bridge/actions_lane.rs index b142e130..eafae3c7 100644 --- a/uplink/src/base/bridge/actions_lane.rs +++ b/uplink/src/base/bridge/actions_lane.rs @@ -354,7 +354,12 @@ impl ActionsBridge { self.streams.forward(response.clone()).await; if response.is_completed() || response.is_failed() { - self.clear_current_action(); + if let Some(CurrentAction { cancelled_by: Some(cancel_action), .. }) = + self.current_action.take() + { + let response = ActionResponse::success(&cancel_action.action_id); + self.streams.forward(response).await; + } return; } diff --git a/uplink/src/collector/downloader.rs b/uplink/src/collector/downloader.rs index 4120a045..cdb35384 100644 --- a/uplink/src/collector/downloader.rs +++ b/uplink/src/collector/downloader.rs @@ -94,6 +94,8 @@ pub enum Error { BadSave, #[error("Save file doesn't exist")] NoSave, + #[error("Download has been cancelled")] + Cancelled, } /// This struct contains the necessary components to download and store file as notified by a download file @@ -222,6 +224,8 @@ impl FileDownloader { trace!("Deleting partially downloaded file: {cancellation:?}"); state.clean()?; + + return Err(Error::Cancelled); }, // NOTE: if download has timedout don't do anything, else ensure errors are forwarded after three retries