From 996fdc4fa451aee83c4adbd0c478b068033c5cd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Carlos=20Gonz=C3=A1lez=20Cabrero?= Date: Wed, 30 Mar 2016 13:15:17 +0200 Subject: [PATCH] Remove useless code to identify pdf files --- .../operations/UploadFileOperation.java | 28 ------------------- 1 file changed, 28 deletions(-) diff --git a/src/com/owncloud/android/operations/UploadFileOperation.java b/src/com/owncloud/android/operations/UploadFileOperation.java index 4a6456bfa7..ed1b7ed5b3 100644 --- a/src/com/owncloud/android/operations/UploadFileOperation.java +++ b/src/com/owncloud/android/operations/UploadFileOperation.java @@ -70,31 +70,10 @@ import java.util.concurrent.atomic.AtomicBoolean; */ public class UploadFileOperation extends SyncOperation { - - private static final String MIME_TYPE_PDF = "application/pdf"; - private static final String FILE_EXTENSION_PDF = ".pdf"; - public static final int CREATED_BY_USER = 0; public static final int CREATED_AS_INSTANT_PICTURE = 1; public static final int CREATED_AS_INSTANT_VIDEO = 2; - - /** - * Checks if content provider, using the content:// scheme, returns a file with mime-type - * 'application/pdf' but file has not extension - * @param localPath Full path to a file in the local file system. - * @param mimeType MIME type of the file. - * @return true if is needed to add the pdf file extension to the file - * - * TODO - move to OCFile or Utils class - */ - private static boolean isPdfFileFromContentProviderWithoutExtension(String localPath, - String mimeType) { - return localPath.startsWith(UriUtils.URI_CONTENT_SCHEME) && - mimeType.equals(MIME_TYPE_PDF) && - !localPath.endsWith(FILE_EXTENSION_PDF); - } - public static OCFile obtainNewOCFileToUpload(String remotePath, String localPath, String mimeType) { // MIME type @@ -102,11 +81,6 @@ public class UploadFileOperation extends SyncOperation { mimeType = MimetypeIconUtil.getBestMimeTypeByFilename(localPath); } - // TODO - this is a horrible special case that should not be handled this way - if (isPdfFileFromContentProviderWithoutExtension(localPath, mimeType)){ - remotePath += FILE_EXTENSION_PDF; - } - OCFile newFile = new OCFile(remotePath); newFile.setStoragePath(localPath); newFile.setLastSyncDateForProperties(0); @@ -126,8 +100,6 @@ public class UploadFileOperation extends SyncOperation { return newFile; } - - private static final String TAG = UploadFileOperation.class.getSimpleName(); private Account mAccount;