Hard coded common Microsoft file extensions

This commit is contained in:
M66B
2021-04-05 07:52:04 +02:00
parent f027b2b236
commit 0633e93e62

View File

@@ -143,7 +143,7 @@ public class EntityAttachment {
// For example, sometimes PDF files are sent as application/octet-stream
// https://android.googlesource.com/platform/libcore/+/refs/tags/android-9.0.0_r49/luni/src/main/java/libcore/net/MimeUtils.java
// https://blogs.msdn.microsoft.com/vsofficedeveloper/2008/05/08/office-2007-file-format-mime-types-for-http-content-streaming-2/
// https://docs.microsoft.com/en-us/archive/blogs/vsofficedeveloper/office-2007-file-format-mime-types-for-http-content-streaming-2
if (encryption != null)
return type;
@@ -162,6 +162,24 @@ public class EntityAttachment {
if ("gpx".equals(extension))
return "application/gpx+xml";
if ("doc".equals(extension))
return "application/msword";
if ("docx".equals(extension))
return "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
if ("xls".equals(extension))
return "application/vnd.ms-excel";
if ("xlsx".equals(extension))
return "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
if ("ppt".equals(extension))
return "application/vnd.ms-powerpoint";
if ("pptx".equals(extension))
return "application/vnd.openxmlformats-officedocument.presentationml.presentation";
if ("pdf".equals(extension))
return "application/pdf";
@@ -179,9 +197,6 @@ public class EntityAttachment {
(type.endsWith("/pdf") || type.endsWith("/x-pdf")))
return "application/pdf";
if ("application/vnd.ms-pps".equals(type))
return "application/vnd.ms-powerpoint";
// Guess types
if (gtype != null) {
if (TextUtils.isEmpty(type) ||