summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMagnus Hallqvist <magnus.hallqvist@sonymobile.com>2012-05-29 14:37:08 +0200
committerKenneth Andersson <kenneth.andersson@sonymobile.com>2012-09-14 15:11:55 +0200
commit6f7cc4e24b8944a00ec1396419bb11cf6fa00229 (patch)
tree1bb7d8f4d994b47f676f98f11a44191854475f7b /src
parentb7ee3b51919842cd26eb865d28cd9ce8e3ba5a2e (diff)
downloadpackages_apps_browser-6f7cc4e24b8944a00ec1396419bb11cf6fa00229.zip
packages_apps_browser-6f7cc4e24b8944a00ec1396419bb11cf6fa00229.tar.gz
packages_apps_browser-6f7cc4e24b8944a00ec1396419bb11cf6fa00229.tar.bz2
Don't replace file extension when mime-type is incorrect
When downloading content from a server that claims content to be text/plain or application/octet-stream a guess is made of the proper mime-type from a possible "file-extension" in the URL. When creating the filename of the downloaded content any file extension that does not match the mime-type is replaced with one derived from the mime-type (.txt for text/plain, none for application/octet-stream). However the guessed mime-type is not used in the filename creation, so content with a proper file extension but a text/plain mime-type will have its file extension replaced with .txt derived from the incorrect mime-type. This fix will use the guessed mime-type when creating the filename to avoid replacing a correct file extension. Change-Id: I5df642e94948914708af99a4d902b253ac8a48dd
Diffstat (limited to 'src')
-rw-r--r--src/com/android/browser/FetchUrlMimeType.java1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/com/android/browser/FetchUrlMimeType.java b/src/com/android/browser/FetchUrlMimeType.java
index 07c9b93..33b5808 100644
--- a/src/com/android/browser/FetchUrlMimeType.java
+++ b/src/com/android/browser/FetchUrlMimeType.java
@@ -121,6 +121,7 @@ class FetchUrlMimeType extends Thread {
MimeTypeMap.getSingleton().getMimeTypeFromExtension(
MimeTypeMap.getFileExtensionFromUrl(mUri));
if (newMimeType != null) {
+ mimeType = newMimeType;
mRequest.setMimeType(newMimeType);
}
}