fix: remove staging chunks after completed uploads
Successful completion moved the assembled file into data/complete but left the upload staging directory behind, including all chunk files. Remove the upload's staging directory only after the final file has been renamed into place so incomplete and failed uploads remain resumable. A repeat complete request for that old upload id now returns 404 because the temporary upload record has been retired with its chunks. Test Plan: - just check Refs: none
This commit is contained in:
+3
-3
@@ -48,11 +48,11 @@ async fn assembles_completed_upload() -> Result<(), Box<dyn std::error::Error>>
|
||||
b"hello world"
|
||||
);
|
||||
assert!(
|
||||
temp_dir
|
||||
!temp_dir
|
||||
.path()
|
||||
.join("staging")
|
||||
.join(&upload.upload_id)
|
||||
.is_dir()
|
||||
.exists()
|
||||
);
|
||||
|
||||
let duplicate = app
|
||||
@@ -61,7 +61,7 @@ async fn assembles_completed_upload() -> Result<(), Box<dyn std::error::Error>>
|
||||
&format!("/api/uploads/{}/complete", upload.upload_id),
|
||||
)?)
|
||||
.await?;
|
||||
assert_eq!(duplicate.status(), StatusCode::CONFLICT);
|
||||
assert_eq!(duplicate.status(), StatusCode::NOT_FOUND);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user