From 9a9c59af7f1003f6e35ce060482eefda40b380f1 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Fri, 14 Nov 2014 16:27:15 -0800 Subject: Prefer "jpg" over "jpeg" as the extension for "image/jpeg". Bug: 18390752 (cherry picked from commit 2a63032eb1c020ad3e73177951142735e11e044e) Change-Id: I713930b8ad8d8a1353d289c1f9268159c3ad862d --- luni/src/main/java/libcore/net/MimeUtils.java | 3 ++- luni/src/test/java/libcore/net/MimeUtilsTest.java | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/luni/src/main/java/libcore/net/MimeUtils.java b/luni/src/main/java/libcore/net/MimeUtils.java index a5a1469..125ea87 100644 --- a/luni/src/main/java/libcore/net/MimeUtils.java +++ b/luni/src/main/java/libcore/net/MimeUtils.java @@ -259,8 +259,9 @@ public final class MimeUtils { add("image/ico", "cur"); add("image/ico", "ico"); add("image/ief", "ief"); - add("image/jpeg", "jpeg"); + // add ".jpg" first so it will be the default for guessExtensionFromMimeType add("image/jpeg", "jpg"); + add("image/jpeg", "jpeg"); add("image/jpeg", "jpe"); add("image/pcx", "pcx"); add("image/png", "png"); diff --git a/luni/src/test/java/libcore/net/MimeUtilsTest.java b/luni/src/test/java/libcore/net/MimeUtilsTest.java index 36476e9..9bfb375 100644 --- a/luni/src/test/java/libcore/net/MimeUtilsTest.java +++ b/luni/src/test/java/libcore/net/MimeUtilsTest.java @@ -42,4 +42,8 @@ public class MimeUtilsTest extends TestCase { assertEquals("png", MimeUtils.guessExtensionFromMimeType("image/png")); assertEquals("zip", MimeUtils.guessExtensionFromMimeType("application/zip")); } + + public void test_18390752() { + assertEquals("jpg", MimeUtils.guessExtensionFromMimeType("image/jpeg")); + } } -- cgit v1.1