Ver Fonte

Use filename instead path

Signed-off-by: alperozturk <alper_ozturk@proton.me>
alperozturk há 1 ano atrás
pai
commit
5b51aed284

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

@@ -237,7 +237,7 @@ class FileUploadWorker(
     }
 
     private fun cleanupUploadProcess(result: RemoteOperationResult<Any?>, operation: UploadFileOperation) {
-        if (operation.originalStoragePath == operation.uploadedSourcePath) {
+        if (operation.originalStoragePath.contains(operation.uploadedFilename)) {
             // 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

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

@@ -998,19 +998,22 @@ public class UploadFileOperation extends SyncOperation {
         }
     }
 
-    private String uploadedSourcePath;
+    private String uploadedFilename;
 
-    public String getUploadedSourcePath(){
-        return uploadedSourcePath;
+    public String getUploadedFilename(){
+        return uploadedFilename;
     }
 
-    public void setUploadedSourcePath(String uploadedSourcePath){
-        this.uploadedSourcePath = uploadedSourcePath;
+    public void setUploadedFilename(String uploadedFilename){
+        this.uploadedFilename = uploadedFilename;
     }
 
     private void logResult(RemoteOperationResult result, String sourcePath, String targetPath) {
         if (result.isSuccess()) {
-            setUploadedSourcePath(sourcePath);
+            int lastIndex = sourcePath.lastIndexOf("/");
+            String filename = sourcePath.substring(lastIndex + 1);
+            setUploadedFilename(filename);
+
             Log_OC.i(TAG, "Upload of " + sourcePath + " to " + targetPath + ": " + result.getLogMessage());
         } else {
             if (result.getException() != null) {