Conversation
...src/main/java/com/owncloud/android/datamodel/e2e/v2/decrypted/DecryptedFolderMetadataFile.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/com/owncloud/android/operations/RefreshFolderOperation.java
Outdated
Show resolved
Hide resolved
|
|
||
| if (E2EVersionHelper.INSTANCE.isV2orAbove(version)) { | ||
| EncryptionUtilsV2 encryptionUtilsV2 = new EncryptionUtilsV2(); | ||
| return encryptionUtilsV2.parseAnyMetadata(getMetadataOperationResult.getResultData(), |
There was a problem hiding this comment.
encryptionUtilsV2.parseAnyMetadata needs to be used for v2.1 and v2.0.
| RemoteOperationResult<String> uploadMetadataOperationResult; | ||
| if (metadataExists) { | ||
| // update metadata | ||
| if (version == E2EVersion.V2_0) { |
There was a problem hiding this comment.
Exact version checks break the app and require manual updates for every new version. This logic has been replaced with E2EVersionHelper.
| object : TypeToken<EncryptedFolderMetadataFile>() {} | ||
| ) | ||
|
|
||
| val decryptedFolderMetadata = if (v2.version == "2.0" || v2.version == "2") { |
There was a problem hiding this comment.
v2.version == "2.0" || v2.version == "2" Fragile and dangerous check and it will not work with 2.1 replaced with E2EVersionHelper.fromVersionString
| * Supports both V1 and V2 metadata formats and falls back safely | ||
| * to [E2EVersion.UNKNOWN] if parsing fails. | ||
| */ | ||
| fun fromMetadata(metadata: String): E2EVersion = runCatching { |
There was a problem hiding this comment.
Replacement of public static E2EVersion determinateVersion(String metadata) {
Tries v1 if fails v2 if fails E2EVersion.UNKNOWN
| @Transient | ||
| val filedrop: MutableMap<String, DecryptedFile> = HashMap(), | ||
| val version: String = "2.0" | ||
| val version: String = E2EVersionHelper.latestVersion(true).value |
There was a problem hiding this comment.
Replaces hardcoded hidden strings with actual latest version so that in future we dont come across issues like this. @tobiasKaminsky
| localFilesMap = prefillLocalFilesMap(metadataFileV1, fileDataStorageManager.getFolderContent(mLocalFolder, false)); | ||
| } else { | ||
| e2EVersion = E2EVersion.V2_0; | ||
| e2EVersion = E2EVersionHelper.INSTANCE.latestVersion(true); |
There was a problem hiding this comment.
Again, for each version iteration, these hidden hardcoded values need to be upgraded. With latestVersion function we can just replace from there. In this case, E2EVersion.V2_1 should be the new value.
a490d85 to
ab0e05f
Compare
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
ab0e05f to
f48f2be
Compare
|
APK file: https://www.kaminsky.me/nc-dev/android-artifacts/16345.apk |
|
blue-Light-Screenshot test failed, but no output was generated. Maybe a preliminary stage failed. |

Issue
The introduction of
E2EE v2.1exposed multiple code paths that relied on exact version matching(== 2.0), causing logic meant for v2.x to be skipped. As a result, the app crashes when interacting with encrypted folders created using E2EE 2.1.How to reproduce
Changes