浏览代码

Normalize local target path in auto upload

This closes #2131 and closes #4220.
Stephan Ritscher 5 年之前
父节点
当前提交
5c387fac7a
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      src/main/java/com/owncloud/android/utils/FileStorageUtils.java

+ 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);
     }