Explorar o código

Stop upload process from external apps with content scheme uris

Juan Carlos González Cabrero %!s(int64=9) %!d(string=hai) anos
pai
achega
9f51a01c82
Modificáronse 1 ficheiros con 20 adicións e 17 borrados
  1. 20 17
      src/com/owncloud/android/ui/activity/FileDisplayActivity.java

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

@@ -765,23 +765,26 @@ public class FileDisplayActivity extends HookActivity
         OCFile currentDir = getCurrentDir();
         String remotePath = (currentDir != null) ? currentDir.getRemotePath() : OCFile.ROOT_PATH;
 
-        if (filePath.startsWith(UriUtils.URI_CONTENT_SCHEME)) {
-            Cursor cursor = getContentResolver().query(Uri.parse(filePath), null, null, null, null);
-            try {
-                if (cursor != null && cursor.moveToFirst()) {
-                    String displayName = cursor.getString(cursor.getColumnIndex(
-                            OpenableColumns.DISPLAY_NAME));
-                    Log_OC.v(TAG, "Display Name: " + displayName);
-
-                    displayName.replace(File.separatorChar, '_');
-                    displayName.replace(File.pathSeparatorChar, '_');
-                    remotePath += displayName + DisplayUtils.getComposedFileExtension(filePath);
-
-                }
-                // and what happens in case of error?; wrong target name for the upload
-            } finally {
-                cursor.close();
-            }
+        if (selectedImageUri.toString().startsWith(UriUtils.URI_CONTENT_SCHEME)) {
+//            Cursor cursor = getContentResolver().query(Uri.parse(filePath), null, null, null, null);
+//            try {
+//                if (cursor != null && cursor.moveToFirst()) {
+//                    String displayName = cursor.getString(cursor.getColumnIndex(
+//                            OpenableColumns.DISPLAY_NAME));
+//                    Log_OC.v(TAG, "Display Name: " + displayName);
+//
+//                    displayName.replace(File.separatorChar, '_');
+//                    displayName.replace(File.pathSeparatorChar, '_');
+//                    remotePath += displayName + DisplayUtils.getComposedFileExtension(filePath);
+//
+//                }
+//                // and what happens in case of error?; wrong target name for the upload
+//            } finally {
+//                cursor.close();
+//            }
+            // Pending to be fixed
+            Toast.makeText(this, R.string.common_error_unknown, Toast.LENGTH_SHORT).show();
+            return;
 
         } else {
             remotePath += new File(filePath).getName();