Remove useless code to identify pdf files

This commit is contained in:
Juan Carlos González Cabrero 2016-03-30 13:15:17 +02:00
parent 7d5a44b4e5
commit 996fdc4fa4

View file

@ -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;