Browse Source

Normalize local target path in auto upload

This closes #2131 and closes #4220.
Stephan Ritscher 5 năm trước cách đây
mục cha
commit
5c387fac7a

+ 2 - 1
src/main/java/com/owncloud/android/utils/FileStorageUtils.java

@@ -172,7 +172,8 @@ public final class FileStorageUtils {
             subPath = getSubPathFromDate(dateTaken, current);
         }
 
-        return remotePath + OCFile.PATH_SEPARATOR + subPath + (fileName == null ? "" : fileName);
+        /* Path must be normalized; otherwise the next RefreshFolderOperation has a mismatch and deletes the local file. */
+        return (remotePath + OCFile.PATH_SEPARATOR + subPath + (fileName == null ? "" : fileName)).replaceAll(OCFile.PATH_SEPARATOR + "+", OCFile.PATH_SEPARATOR);
     }