fix(e2ee): refresh during crud operations#17267
Conversation
|
|
||
| parentFolder.setE2eCounter(metadata.metadata.counter) | ||
| val storageManager = FileDataStorageManager(user, context.contentResolver) | ||
| storageManager.saveFile(parentFolder) |
There was a problem hiding this comment.
Should be after serializeAndUploadMetadata
| metadata, | ||
| getStorageManager()); | ||
|
|
||
| parentFile.setE2eCounter(metadata.getMetadata().getCounter()); |
There was a problem hiding this comment.
Should be after serializeAndUploadMetadata
|
|
||
| metadataFile.metadata.files[encryptedFileName] = decryptedFile | ||
| metadataFile.metadata.counter++ | ||
| ocFile.setE2eCounter(metadataFile.metadata.counter) |
There was a problem hiding this comment.
addFileToMetadata has one caller and that already updates counter. No need to double it.
There was a problem hiding this comment.
Also aligns with other functions such as removeFolderFromMetadata
| ): DecryptedFolderMetadataFile { | ||
| metadataFile.metadata.folders[encryptedFileName] = fileName | ||
| metadataFile.metadata.counter++ | ||
| ocFile.setE2eCounter(metadataFile.metadata.counter) |
There was a problem hiding this comment.
addFolderToMetadata has one caller and that already updates counter. No need to double it.
There was a problem hiding this comment.
Also aligns with other functions such as removeFolderFromMetadata
|
APK file: https://github.com/nextcloud/android/actions/runs/28519645539/artifacts/8011646161 |
a68af81 to
9be910e
Compare
|
APK file: https://github.com/nextcloud/android/actions/runs/29005173465/artifacts/8193741488 |
| boolean isWorkScheduled = WorkManagerExtensionsKt.isWorkScheduled(workManager, tag); | ||
| if (isWorkScheduled) { | ||
| Log_OC.d(TAG, "Upload worker running for " + user.getAccountName() + "; deferring metadata/counter update to next refresh"); | ||
| return; |
There was a problem hiding this comment.
Please check if the counter is really correctly updated?
I assume that counter is not correctly updated for upload work and thus it works only if we do the operations one after another.
Please double check.
There was a problem hiding this comment.
- User tries to upload 5 encrypted files
UploadFileOperationupdates counter one by one after each successful upload- User during uploads do the pull-to-refresh
- Refresh folder operation uses
mLocalFolderand sends old counter e.g. 22 - The refresh downloads metadata still at 22, but the upload already pushed the local counter to 23
- Crashes because after pull to refresh upload operation at that time didn't push the latest value yet because it received 22 at that time.
This is not related to the updating logic, this is related to the timing and async execution.
Solution:
- Don't let the refresh verify metadata for a folder while an upload still in progress
- ?
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
Signed-off-by: alperozturk96 <alper_ozturk@proton.me> # Conflicts: # app/src/main/java/com/owncloud/android/ui/fragment/FileDetailSharingFragment.java
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
217f1b1 to
6e52bf6
Compare
|
APK file: https://github.com/nextcloud/android/actions/runs/29577078416/artifacts/8405696732 |
|
APK file: https://github.com/nextcloud/android/actions/runs/29578868607/artifacts/8406318076 |
|
blue-Light-Screenshot test failed, but no output was generated. Maybe a preliminary stage failed. |
|
APK file: https://github.com/nextcloud/android/actions/runs/29581557894/artifacts/8407647313 |
|
master-IT test failed: https://www.kaminsky.me/nc-dev/android-integrationTests/17267-IT-master-15-24 |
Issue
Refreshing folder causing crash during crud operations in encrypted folder. Local counter should be only updated after completion of operation.
Changes
serializeAndUploadMetadata