Browse Source

Fixed local database incoherence when files whit special characters in their name are uploadad

David A. Velasco 13 years ago
parent
commit
7dfc47ced4
2 changed files with 4 additions and 3 deletions
  1. 1 1
      AndroidManifest.xml
  2. 3 2
      src/eu/alefzero/owncloud/files/services/FileUploader.java

+ 1 - 1
AndroidManifest.xml

@@ -18,7 +18,7 @@
  -->
 <manifest package="eu.alefzero.owncloud"
     android:versionCode="1"
-    android:versionName="0.1.128B" xmlns:android="http://schemas.android.com/apk/res/android">
+    android:versionName="0.1.129B" xmlns:android="http://schemas.android.com/apk/res/android">
 
     <uses-permission android:name="android.permission.GET_ACCOUNTS" />
     <uses-permission android:name="android.permission.USE_CREDENTIALS" />

+ 3 - 2
src/eu/alefzero/owncloud/files/services/FileUploader.java

@@ -176,12 +176,13 @@ public class FileUploader extends Service implements OnDatatransferProgressListe
             mCurrentIndexUpload = i;
             if (wc.putFile(mLocalPaths[i], mRemotePaths[i], mimeType)) {
                 mResult |= true;
-                OCFile new_file = new OCFile(mRemotePaths[i]);
+                String decRemotePath = URLDecoder.decode(mRemotePaths[i]);
+                OCFile new_file = new OCFile(decRemotePath);    // FyleSyncAdapter and this MUST use the same encoding when creating a new OCFile
                 new_file.setMimetype(mimeType);
                 new_file.setFileLength(new File(mLocalPaths[i]).length());
                 new_file.setModificationTimestamp(System.currentTimeMillis());
                 new_file.setLastSyncDate(0);
-                new_file.setStoragePath(mLocalPaths[i]);
+                new_file.setStoragePath(mLocalPaths[i]);         
                 File f = new File(URLDecoder.decode(mRemotePaths[i]));
                 new_file.setParentId(storageManager.getFileByPath(f.getParent().endsWith("/")?f.getParent():f.getParent()+"/").getFileId());
                 storageManager.saveFile(new_file);