Merge branch '2.5.x' into 2.6.x

Closes gh-29750
pull/30003/head
Andy Wilkinson 3 years ago
commit 4b33ea733e

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2022 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -128,7 +128,7 @@ public final class MimeMappings implements Iterable<MimeMappings.Mapping> {
mappings.add("otg", "application/vnd.oasis.opendocument.graphics-template"); mappings.add("otg", "application/vnd.oasis.opendocument.graphics-template");
mappings.add("oth", "application/vnd.oasis.opendocument.text-web"); mappings.add("oth", "application/vnd.oasis.opendocument.text-web");
mappings.add("otp", "application/vnd.oasis.opendocument.presentation-template"); mappings.add("otp", "application/vnd.oasis.opendocument.presentation-template");
mappings.add("ots", "application/vnd.oasis.opendocument.spreadsheet-template "); mappings.add("ots", "application/vnd.oasis.opendocument.spreadsheet-template");
mappings.add("ott", "application/vnd.oasis.opendocument.text-template"); mappings.add("ott", "application/vnd.oasis.opendocument.text-template");
mappings.add("ogx", "application/ogg"); mappings.add("ogx", "application/ogg");
mappings.add("ogv", "video/ogg"); mappings.add("ogv", "video/ogg");

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2022 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -20,6 +20,7 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.regex.Pattern;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
@ -135,4 +136,11 @@ class MimeMappingsTests {
assertThat(unmodifiable.get("foo")).isNull(); assertThat(unmodifiable.get("foo")).isNull();
} }
@Test
void mimeTypesInDefaultMappingsAreCorrectlyStructured() {
String regName = "[A-Za-z0-9!#$&.+\\-^_]{1,127}";
Pattern pattern = Pattern.compile("^" + regName + "\\/" + regName + "$");
assertThat(MimeMappings.DEFAULT).allSatisfy((mapping) -> assertThat(mapping.getMimeType()).matches(pattern));
}
} }

Loading…
Cancel
Save