Commit 46e79508 authored by Tsuyoshi Horo's avatar Tsuyoshi Horo Committed by Commit Bot

Set multipart/related mime type again for download pages on Android 10

Android Q's MediaStore.Downloads has an issue that the custom mime type which is not
supported by MimeTypeMap is overridden to "application/octet-stream" when publishing.
To deal with this issue we set the mime type again after publishing.

Bug: 1010829
Change-Id: Ia33cafa25f87095d1f21553c3dcd23bcee96d0ff
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1839151Reviewed-by: default avatarPeter Williamson <petewil@chromium.org>
Commit-Queue: Tsuyoshi Horo <horo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#703141}
parent 4acc7fda
...@@ -203,6 +203,15 @@ public class OfflinePageArchivePublisherBridge { ...@@ -203,6 +203,15 @@ public class OfflinePageArchivePublisherBridge {
Log.d(TAG, "Failed to finish publishing archive."); Log.d(TAG, "Failed to finish publishing archive.");
} }
// Android Q's MediaStore.Downloads has an issue that the custom mime type which is not
// supported by MimeTypeMap is overridden to "application/octet-stream" when publishing.
// To deal with this issue we set the mime type again after publishing.
// See crbug.com/1010829 for more details.
final ContentValues mimeTypeValues = new ContentValues();
mimeTypeValues.put(MediaColumns.MIME_TYPE, "multipart/related");
if (contentResolver.update(intermediateUri, mimeTypeValues, null, null) != 1) {
Log.d(TAG, "Failed to update mime type.");
}
return intermediateUri.toString(); return intermediateUri.toString();
} }
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment