Repository navigation
fix: create the missing destination folder when retrying an automatic upload - #5033
RaphaelFakhri wants to merge 4 commits into
Conversation
Signed-off-by: Raphael Fakhri <[email protected]>
Signed-off-by: Raphael Fakhri <[email protected]>
|
@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 |
|
@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. |
joragua
left a comment
There was a problem hiding this comment.
Hi @RaphaelFakhri! The first CR round is here! 🙌🏻
NOTE: The third commit (fix: create the missing destination folder when retrying an upload) is missing the Signed-off-by line. We will not be able to merge the PR until all commits have the proper sign-off.
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 <[email protected]> Signed-off-by: Raphael Fakhri <[email protected]>
a6f0026 to
c7c3fca
Compare
|
All commits are now signed off. I added the missing Signed-off-by line to the third commit (now f4e2bef) and force-pushed. The first two commits are unchanged. |
Signed-off-by: Raphael Fakhri <[email protected]>
c7c3fca to
d7a4a3d
Compare
|
Just an extra comment and it should be ready for QA! @RaphaelFakhri We use to have only commit for the calens file in each PR. Could you rebase the branch and include the final version in the second commit? You can also amend the first commit to drop the tests from it. After that, the final history should look like this: 1 -> NOTE: Remember that all commits must be GPG signed and include a Feel free to ping us if you have any doubts! Thanks! |
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.