Эх сурвалжийг харах

Refactoring and minor changes

Signed-off-by: ZetaTom <70907959+ZetaTom@users.noreply.github.com>
ZetaTom 1 жил өмнө
parent
commit
de1dcfe93a

+ 1 - 1
app/src/main/java/com/nextcloud/client/jobs/upload/FileUploadWorker.kt

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

+ 9 - 8
app/src/main/java/com/owncloud/android/operations/UploadFileOperation.java

@@ -759,6 +759,10 @@ public class UploadFileOperation extends SyncOperation {
                 result = new RemoteOperationResult(ResultCode.UNKNOWN_ERROR);
                 result = new RemoteOperationResult(ResultCode.UNKNOWN_ERROR);
             }
             }
 
 
+            if (result.isSuccess()) {
+                setUploadedDecyptedRemotePath(mFile.getDecryptedRemotePath());
+            }
+
             logResult(result, mFile.getStoragePath(), mFile.getRemotePath());
             logResult(result, mFile.getStoragePath(), mFile.getRemotePath());
 
 
             // unlock must be done always
             // 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) {
     private void logResult(RemoteOperationResult result, String sourcePath, String targetPath) {
         if (result.isSuccess()) {
         if (result.isSuccess()) {
-            String filename = sourcePath.substring(sourcePath.lastIndexOf('/') + 1);
-            setUploadedFilename(filename);
-
             Log_OC.i(TAG, "Upload of " + sourcePath + " to " + targetPath + ": " + result.getLogMessage());
             Log_OC.i(TAG, "Upload of " + sourcePath + " to " + targetPath + ": " + result.getLogMessage());
         } else {
         } else {
             if (result.getException() != null) {
             if (result.getException() != null) {