Refactoring and minor changes

Signed-off-by: ZetaTom <70907959+ZetaTom@users.noreply.github.com>
This commit is contained in:
ZetaTom 2024-04-04 13:46:35 +02:00
parent 761d37de01
commit de1dcfe93a
No known key found for this signature in database
GPG key ID: 3536EB6B4203D957
2 changed files with 10 additions and 9 deletions

View file

@ -235,7 +235,7 @@ class FileUploadWorker(
}
private fun cleanupUploadProcess(result: RemoteOperationResult<Any?>, operation: UploadFileOperation) {
if (operation.originalStoragePath.contains(operation.uploadedFilename)) {
if (operation.decryptedRemotePath == operation.uploadedDecyptedRemotePath) {
// TODO
// This is not ideal fix. When uploading file to the encrypted folder server returns 404 FILE_NOT_FOUND
// However file upload successfully completed. This fix mimic success, if upload successfully completed with

View file

@ -759,6 +759,10 @@ public class UploadFileOperation extends SyncOperation {
result = new RemoteOperationResult(ResultCode.UNKNOWN_ERROR);
}
if (result.isSuccess()) {
setUploadedDecyptedRemotePath(mFile.getDecryptedRemotePath());
}
logResult(result, mFile.getStoragePath(), mFile.getRemotePath());
// unlock must be done always
@ -998,21 +1002,18 @@ public class UploadFileOperation extends SyncOperation {
}
}
private String uploadedFilename;
private String uploadedDecyptedRemotePath;
public String getUploadedFilename(){
return uploadedFilename;
public String getUploadedDecyptedRemotePath(){
return uploadedDecyptedRemotePath;
}
public void setUploadedFilename(String uploadedFilename){
this.uploadedFilename = uploadedFilename;
public void setUploadedDecyptedRemotePath(String uploadedDecyptedRemotePath){
this.uploadedDecyptedRemotePath = uploadedDecyptedRemotePath;
}
private void logResult(RemoteOperationResult result, String sourcePath, String targetPath) {
if (result.isSuccess()) {
String filename = sourcePath.substring(sourcePath.lastIndexOf('/') + 1);
setUploadedFilename(filename);
Log_OC.i(TAG, "Upload of " + sourcePath + " to " + targetPath + ": " + result.getLogMessage());
} else {
if (result.getException() != null) {