Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,9 @@ private Bitmap doThumbnailFromOCFileInBackground() {
String imageKey = PREFIX_THUMBNAIL + file.getRemoteId();

boolean updateEnforced = (file instanceof OCFile && ((OCFile) file).isUpdateThumbnailNeeded());
if (MimeTypeUtil.isZip(file)) {
return null;
}

// Try to load thumbnail from disk cache
if (!updateEnforced) {
Expand Down
21 changes: 21 additions & 0 deletions app/src/main/java/com/owncloud/android/utils/MimeTypeUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,27 @@ public static boolean isPDF(OCFile file) {
return isPDF(file.getMimeType()) || isPDF(getMimeTypeFromPath(file.getRemotePath()));
}

public static boolean isZip(String mimeType) {
if (mimeType == null) {
return false;
}
String lower = mimeType.toLowerCase(Locale.ROOT);
return lower.equals("application/zip")
|| lower.equals("application/x-7z-compressed")
|| lower.equals("application/x-bzip2")
|| lower.equals("application/x-compressed")
|| lower.equals("application/x-deb")
|| lower.equals("application/gzip")
|| lower.equals("application/x-gzip")
|| lower.equals("application/x-rar-compressed")
|| lower.equals("application/x-tar")
|| lower.equals("application/vnd.android.package-archive");
}

public static boolean isZip(ServerFileInterface file) {
return isZip(file.getMimeType());
}

/**
* Extracts the mime type for the given file.
*
Expand Down
Loading