|
@@ -441,6 +441,7 @@ public class UploadFileOperation extends SyncOperation {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // TODO REFACTOR
|
|
|
@SuppressLint("AndroidLintUseSparseArrays") // gson cannot handle sparse arrays easily, therefore use hashmap
|
|
|
private RemoteOperationResult encryptedUpload(OwnCloudClient client, OCFile parentFile) {
|
|
|
RemoteOperationResult result = null;
|
|
@@ -489,13 +490,18 @@ public class UploadFileOperation extends SyncOperation {
|
|
|
// mContext);
|
|
|
|
|
|
Object object = EncryptionUtils.downloadFolderMetadata(parentFile, client, mContext, user);
|
|
|
+ if (object != null) {
|
|
|
+ if (object instanceof DecryptedFolderMetadataFileV1) {
|
|
|
+ if (((DecryptedFolderMetadataFileV1) object).getMetadata() != null) {
|
|
|
+ metadataExists = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
if (CapabilityUtils.getCapability(mContext).getEndToEndEncryptionApiVersion().compareTo(E2EVersion.V2_0) >= 0) {
|
|
|
if (object == null) {
|
|
|
// TODO return error
|
|
|
return new RemoteOperationResult(new IllegalStateException("Metadata does not exist"));
|
|
|
- } else {
|
|
|
- metadataExists = true;
|
|
|
}
|
|
|
} else {
|
|
|
// v1 is allowed to be null, thus create it
|
|
@@ -512,7 +518,6 @@ public class UploadFileOperation extends SyncOperation {
|
|
|
}
|
|
|
|
|
|
object = metadata;
|
|
|
- metadataExists = true;
|
|
|
}
|
|
|
|
|
|
// todo fail if no metadata
|
|
@@ -696,7 +701,6 @@ public class UploadFileOperation extends SyncOperation {
|
|
|
serializedFolderMetadata = EncryptionUtils.serializeJSON(encryptedFolderMetadata);
|
|
|
}
|
|
|
|
|
|
- // FIXME after first failed upload folder stay locked, uploadMetadata throws UploadException for encrypted folder
|
|
|
// upload metadata
|
|
|
EncryptionUtils.uploadMetadata(parentFile,
|
|
|
serializedFolderMetadata,
|