Repository navigation
Abort a hydration request on failure - #1067
Conversation
4c7efbb to
1659ade
Compare
1659ade to
90d91b3
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The new CFAPI error completion path likely passes an invalid TransferData buffer/length combination on failure, risking CfExecute failing and leaving hydration requests improperly completed.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR addresses a crash in the CFAPI VFS hydration path when a dehydrated placeholder is hydrated but the corresponding remote file is already gone (e.g., renamed/deleted and the change hasn’t propagated locally yet), by treating a 404 as an out-of-sync condition and ensuring the hydration request is completed with an error.
Changes:
- Add a regression test that forces a single 404 on hydration and verifies
needSyncis emitted for dehydrated files. - Treat HTTP 404 during hydration as “file not found” and emit
needSyncto recover from out-of-sync metadata. - On hydration failure, attempt to complete the CFAPI transfer operation with an error via
CfExecute.
File summaries
| File | Description |
|---|---|
| test/testdownload.cpp | Adds a dehydrated-file regression test for a one-time 404 hydration failure triggering needSync. |
| src/plugins/vfs/cfapi/hydrationdevice.cpp | Reports hydration failure back to CFAPI via CfExecute so the request is completed/aborted on error. |
| src/libsync/vfs/hydrationjob.h | Exposes the hydration device via a new accessor. |
| src/libsync/vfs/hydrationjob.cpp | Adds explicit handling for HTTP 404 to emit needSync and report “File not found”. |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
|
||
| QByteArray fileId() const { return _fileId; } | ||
|
|
||
| QIODevice *device() const { return _device.get(); } |
| opParams.TransferData.CompletionStatus = STATUS_CLOUD_FILE_NOT_IN_SYNC; | ||
|
|
||
| // the error affects the whole file, not a transfer chunk | ||
| opParams.TransferData.Offset.QuadPart = 0; | ||
| opParams.TransferData.Length.QuadPart = totalSize; |
Fixes: #1060