Fix hanging WebDAV downloads by resuming transfers after File Provider registration#467
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
Walkthrough
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@tobihagemann Why resume in the error case instead of calling |
|
I must admit that I'm also looking at reference clients like ownCloud, which logs the error and resumes anyway, and Nextcloud, which catches it and resumes anyway. Neither cancels. So I hope and guess that this is the right way to do it. 😅 |
|
Oh! So register has to be called prior to resume to avoid the UI from appearing hung, but if registration fails you can still proceed to download without the UI showing it. That makes sense. However, an edge case that comes to mind is this: Would you happen to know if that's a possibility? I couldn't find a guard check around this path. |
Fixes #449.
In Files.app, tapping a WebDAV file to open it never downloads or opens: the spinner just spins forever. Some users also see "Couldn't communicate with a helper application" when they tap the stuck item again, and locking/unlocking the vault clears it temporarily. Reported on 2.8.3 through 3.1.0.
Root cause:
FileProviderAdapterresumed the transfer'sURLSessionTaskbeforeNSFileProviderManager.register(_:forItemWithIdentifier:)had completed. That ordering shipped in 2.8.0 (ec9703b), as a side effect of the #272 upload fix in #438, which movedresume()out of the registration completion handler. Starting the transfer before the system has registered it can leave the File Provider hanging.The fix moves
urlSessionTask.resume()back inside the registration completion handler, on both the success and error branches, so a transfer still always resumes even when registration fails (the guarantee #272 needed). Applied to both the download and upload paths.Flow
iOS side only, no cloud-access-swift change.
Validated on a physical device (iOS 26.5): the hang no longer reproduces. New regression tests (
FileProviderAdapterResumeOrderingTests) cover the download and upload paths for both the success-ordering and registration-failure cases, and theCryptomatorFileProvidersuite is green.Out of scope: re-tapping a still-downloading file triggers the unimplemented
stopProvidingItemand crashes the extension. That's a separate, pre-existing bug, not addressed here.