Commit 075e7557 authored by Evan W. Patton's avatar Evan W. Patton Committed by Jeffrey Schiller

Remove charset declaration from Android MIME type

Android apps are binary blobs, not UTF-8. It's possible that the
archive includes byte sequences that are invalid UTF-8 and we can't
expect clients to do the right thing when they encounter such data.

Change-Id: Iad16c06f7e977c44e2c71ab3f7952036a03fb22e
parent 96237457
...@@ -121,7 +121,7 @@ public class StorageUtil { ...@@ -121,7 +121,7 @@ public class StorageUtil {
} }
if (filePath.endsWith(".apk")) { if (filePath.endsWith(".apk")) {
return "application/vnd.android.package-archive; charset=utf-8"; return "application/vnd.android.package-archive";
} }
if (filePath.endsWith(".aia")) { if (filePath.endsWith(".aia")) {
......
...@@ -132,7 +132,7 @@ public class DownloadServletTest { ...@@ -132,7 +132,7 @@ public class DownloadServletTest {
MockHttpServletResponse response = new MockHttpServletResponse(); MockHttpServletResponse response = new MockHttpServletResponse();
download.doGet(request, response); download.doGet(request, response);
checkResponseHeader(response, "attachment; filename=\"filename123.apk\""); checkResponseHeader(response, "attachment; filename=\"filename123.apk\"");
assertEquals("application/vnd.android.package-archive; charset=utf-8", assertEquals("application/vnd.android.package-archive",
response.getContentType()); response.getContentType());
PowerMock.verifyAll(); PowerMock.verifyAll();
} }
...@@ -148,7 +148,7 @@ public class DownloadServletTest { ...@@ -148,7 +148,7 @@ public class DownloadServletTest {
MockHttpServletResponse response = new MockHttpServletResponse(); MockHttpServletResponse response = new MockHttpServletResponse();
download.doGet(request, response); download.doGet(request, response);
checkResponseHeader(response, "attachment; filename=\"filename123.apk\""); checkResponseHeader(response, "attachment; filename=\"filename123.apk\"");
assertEquals("application/vnd.android.package-archive; charset=utf-8", assertEquals("application/vnd.android.package-archive",
response.getContentType()); response.getContentType());
PowerMock.verifyAll(); PowerMock.verifyAll();
} }
......
...@@ -49,7 +49,7 @@ public class StorageUtilTest extends TestCase { ...@@ -49,7 +49,7 @@ public class StorageUtilTest extends TestCase {
assertEquals("image/jpeg", StorageUtil.getContentTypeForFilePath("kitty.jpg")); assertEquals("image/jpeg", StorageUtil.getContentTypeForFilePath("kitty.jpg"));
assertEquals("image/jpeg", StorageUtil.getContentTypeForFilePath("kitty.jpeg")); assertEquals("image/jpeg", StorageUtil.getContentTypeForFilePath("kitty.jpeg"));
assertEquals("image/png", StorageUtil.getContentTypeForFilePath("kitty.png")); assertEquals("image/png", StorageUtil.getContentTypeForFilePath("kitty.png"));
assertEquals("application/vnd.android.package-archive; charset=utf-8", assertEquals("application/vnd.android.package-archive",
StorageUtil.getContentTypeForFilePath("HelloPurr.apk")); StorageUtil.getContentTypeForFilePath("HelloPurr.apk"));
assertEquals("application/zip; charset=utf-8", assertEquals("application/zip; charset=utf-8",
StorageUtil.getContentTypeForFilePath("HelloPurr.aia")); StorageUtil.getContentTypeForFilePath("HelloPurr.aia"));
......
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