Răsfoiți Sursa

Minor refactor and added CR comment

jabarros 9 ani în urmă
părinte
comite
a0f2e7ab23

+ 6 - 6
src/com/owncloud/android/ui/activity/FileDisplayActivity.java

@@ -777,12 +777,12 @@ public class FileDisplayActivity extends HookActivity
                     displayName.replace(File.separatorChar, '_');
                     displayName.replace(File.pathSeparatorChar, '_');
 
-                    // Check if extension is included in file name
+                    remotePath += displayName;
+
+                    // Check if extension is not included in file display name and add file extension
                     int pos = displayName.lastIndexOf('.');
-                    if (pos >= 0) {
-                        remotePath += displayName;
-                    } else {
-                        remotePath += displayName + DisplayUtils.getComposedFileExtension(filePath);
+                    if (pos < 0) {
+                        remotePath += DisplayUtils.getFileExtension(filePath);
                     }
 
                     // URi and remote path parameters
@@ -798,7 +798,7 @@ public class FileDisplayActivity extends HookActivity
                 }
                 // and what happens in case of error?; wrong target name for the upload
             } catch (Exception e) {
-                Log_OC.e(TAG, "Error while trying to copy and upload a content schema type file ", e);
+                Log_OC.e(TAG, "Error while trying to copy and upload a schema type content file ", e);
             }
         } else {
             remotePath += new File(filePath).getName();

+ 1 - 1
src/com/owncloud/android/utils/DisplayUtils.java

@@ -177,7 +177,7 @@ public class DisplayUtils {
      * @param filepath: Content Uri converted to string format
      * @return String: fileExtension (type '.pdf'). Empty if no extension
      */
-    public static String getComposedFileExtension(String filepath) {
+    public static String getFileExtension(String filepath) {
         String fileExtension = "";
         String fileNameInContentUri = filepath.substring(filepath.lastIndexOf("/"));