Repository navigation
fix: create the missing destination folder when retrying an automatic upload - #5033
RaphaelFakhri wants to merge 3 commits into
Conversation
Signed-off-by: Raphael Fakhri <153192858+RaphaelFakhri@users.noreply.github.com>
Signed-off-by: Raphael Fakhri <153192858+RaphaelFakhri@users.noreply.github.com>
|
@RaphaelFakhri thanks a lot for your contribution! we'll check it as soon as we have some time for it 😅 . Keep tuned, we could ask you for code review changes or fixes in the code! It's cool to check that the commits are verified and follow the conventional commits convention 💯 Just one consideration: you must sign the CLA, otherwise the PR will not move forward. |
|
Thanks for taking a look. The CLA is already signed for this PR: the CLA assistant check reports that all committers have signed (status). |
|
About the solution here, my feeling is that you put the focus in the double slash This is, a failed automatic upload is marked as |
UploadFileFromFileSystemWorker checked the parent folder with isUserLoggedIn = false, which makes CheckPathExistenceRemoteOperation ignore the path and query the base WebDAV URL. That URL always exists, so a missing destination folder was never created and the PUT failed with 409, marking the upload as a conflict. A failed automatic upload is retried through this worker because the first attempt replaces its content URI with the cached copy, so the retry always hit this check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@jesmrec thanks for reproducing it, you were right. I found the real cause and pushed a fix in 3efc219. A failed automatic upload is retried through I kept the double separator change as a secondary fix, but I can move it to its own PR or drop it if you prefer. I have no test server here, so I checked the fix by tracing the code against the logs. Detekt, the build and the unit tests pass. I updated the description with the details and the manual steps. |
Related Issues
App: Fixes #4451
Main problem: retried automatic uploads end in
ConflictA failed automatic upload is retried through
UploadFileFromFileSystemWorker, notUploadFileFromContentUriWorker. On its first attempt,UploadFileFromContentUriWorker.copyFileToLocalStorage()copies the picture to the app cache and replaces the transfer'slocalPathwith that cached file. On retry the path is no longer a content URI, soRetryFailedUploadsUseCasegoes throughRetryUploadFromSystemUseCase.UploadFileFromFileSystemWorker.checkParentFolderExistence()built its existence check withisUserLoggedIn = false. With that flag,CheckPathExistenceRemoteOperationignoresremotePathand sendsPROPFINDto the base WebDAV URL/remote.php/dav/files/. That URL always exists, so the check returns 207 and the missing destination folder is never created. ThePUTthen gets409 Files cannot be created in non-existent collections, which is stored asConflict. The OC10 log in the issue shows exactly this sequence:The fix passes
isUserLoggedIn = AccountUtils.getCurrentOwnCloudAccount(appContext) != null, asUploadFileFromContentUriWorkerand the name collision check already do. The check then queries/remote.php/dav/files/<user>/<folder>/andCreateRemoteFolderOperationcreates the folder when it is missing.Secondary: double separator in the remote path
Folders picked as the automatic uploads destination can store their path with a trailing separator (for example,
/Bbbbb/), andAutomaticUploadsWorkerappended another one before the file name. The remote path is now composed throughFolderBackUpConfiguration.getRemotePathForFile(), which trims it. This does not cause the conflict and can be split into its own PR if preferred.ReleaseNotesViewModel.ktcreating a newReleaseNote()with String resources (if required): not requiredQA
./gradlew detekt :owncloudDomain:testDebugUnitTest :owncloudApp:compileOriginalDebugKotlin :owncloudApp:testOriginalDebugUnitTestpasses (117 app unit tests).FolderBackUpConfigurationTestcovers the separator change./remote.php/dav/files/<user>/<folder>/followed byMKCOL.