From 128dd20b98e14b61fd86e411c54eaba2173ab917 Mon Sep 17 00:00:00 2001 From: Joshua Bauer Date: Fri, 30 Aug 2019 11:28:18 -0700 Subject: [PATCH] More MediaType improvements. --- .../main/java/io/sinistral/proteus/server/MediaType.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/io/sinistral/proteus/server/MediaType.java b/core/src/main/java/io/sinistral/proteus/server/MediaType.java index 07fda2e..f8db9f2 100644 --- a/core/src/main/java/io/sinistral/proteus/server/MediaType.java +++ b/core/src/main/java/io/sinistral/proteus/server/MediaType.java @@ -974,7 +974,7 @@ public class MediaType public static final MediaType IMAGE_PNG = create("image/png", "png"); public static final MediaType IMAGE_PRS_BTIF = create("image/prs.btif", "btif"); public static final MediaType IMAGE_SGI = create("image/sgi", "sgi"); - public static final MediaType IMAGE_SVG_XML = createUTF8("image/svg+xml", "svg", "svgz"); + public static final MediaType IMAGE_SVG_XML = create("image/svg+xml", "svg", "svgz"); public static final MediaType IMAGE_TIFF = create("image/tiff", "tiff", "tif"); public static final MediaType IMAGE_VND_ADOBE_PHOTOSHOP = create("image/vnd.adobe.photoshop", "psd"); public static final MediaType IMAGE_VND_DECE_GRAPHIC = create("image/vnd.dece.graphic", "uvi", "uvvi", "uvg", @@ -1190,8 +1190,10 @@ public static synchronized MediaType create(String type, String[] attributes, St { MediaType mt = new MediaType(type, attributes); - for (String ext : fileExtensisons) { - FILE_EXTENSIONS.put(ext, mt); + if(!Arrays.stream(attributes).anyMatch(a -> a.equals(UTF8_ATTR[0]))) { + for (String ext : fileExtensisons) { + FILE_EXTENSIONS.put(ext, mt); + } } return mt;