Skip to content

Commit be34c9c

Browse files
committed
refactor: extract variable
1 parent 43c6741 commit be34c9c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/main/java/ru/mystamps/web/support/spring/security/ContentSecurityPolicyHeaderWriter.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ public void writeHeaders(HttpServletRequest request, HttpServletResponse respons
167167

168168
protected String constructDirectives(String uri) {
169169
boolean onCollectionInfoPage = uri.startsWith(COLLECTION_INFO_PAGE_PATTERN);
170+
boolean onSeriesInfoPage = SERIES_INFO_PAGE_PATTERN.matcher(uri).matches();
170171
boolean onAddSeriesPage = uri.equals(SeriesUrl.ADD_SERIES_PAGE);
171172
boolean onH2ConsolePage = h2ConsolePath != null && uri.startsWith(h2ConsolePath);
172173

@@ -223,7 +224,8 @@ protected String constructDirectives(String uri) {
223224
} else if (onH2ConsolePage) {
224225
sb.append(SEPARATOR)
225226
.append(CHILD_SRC);
226-
} else if (SERIES_INFO_PAGE_PATTERN.matcher(uri).matches()) {
227+
228+
} else if (onSeriesInfoPage) {
227229
// anonymous and users without a required authority actually don't need these directives
228230
sb.append(SCRIPTS_SERIES_INFO_PAGE)
229231
.append(SEPARATOR)

0 commit comments

Comments
 (0)