Include /fonts/** to common static locations

This commit updates StaticResourceLocation to include a new entry for
the common locations of fonts. As a result,
StaticResourceRequest#atCommonLocations now includes /fonts/** as well.

See gh-46208

Signed-off-by: Shahab Kondri <shahab.kondri@gmail.com>
This commit is contained in:
Shahab Kondri 2025-06-25 13:14:40 -04:00 committed by Stéphane Nicoll
parent 169b1b10b0
commit 74daedff76
2 changed files with 7 additions and 1 deletions

View File

@ -50,7 +50,12 @@ public enum StaticResourceLocation {
/** /**
* The {@code "favicon.ico"} resource. * The {@code "favicon.ico"} resource.
*/ */
FAVICON("/favicon.*", "/*/icon-*"); FAVICON("/favicon.*", "/*/icon-*"),
/**
* Resources under {@code "/fonts"}.
*/
FONTS("/fonts/**");
private final String[] patterns; private final String[] patterns;

View File

@ -57,6 +57,7 @@ class StaticResourceRequestTests {
assertMatcher(matcher).matches("/favicon.ico"); assertMatcher(matcher).matches("/favicon.ico");
assertMatcher(matcher).matches("/favicon.png"); assertMatcher(matcher).matches("/favicon.png");
assertMatcher(matcher).matches("/icons/icon-48x48.png"); assertMatcher(matcher).matches("/icons/icon-48x48.png");
assertMatcher(matcher).matches("/fonts/font.woff2");
assertMatcher(matcher).doesNotMatch("/bar"); assertMatcher(matcher).doesNotMatch("/bar");
} }