Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polish CorsConfiguration #33650

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
* @author Juergen Hoeller
* @author Sam Brannen
* @author Ruslan Akhundov
* @author khyojun
* @since 4.2
* @see <a href="https://www.w3.org/TR/cors/">CORS spec</a>
*/
Expand All @@ -54,9 +55,11 @@ public class CorsConfiguration {
/** Wildcard representing <em>all</em> origins, methods, or headers. */
public static final String ALL = "*";

private static final String PATH_SEPERATOR = "/";

private static final List<String> ALL_LIST = Collections.singletonList(ALL);

private static final OriginPattern ALL_PATTERN = new OriginPattern("*");
private static final OriginPattern ALL_PATTERN = new OriginPattern(ALL);

private static final List<OriginPattern> ALL_PATTERN_LIST = Collections.singletonList(ALL_PATTERN);

Expand Down Expand Up @@ -157,7 +160,7 @@ public void setAllowedOrigins(@Nullable List<String> origins) {
}

private String trimTrailingSlash(String origin) {
return (origin.endsWith("/") ? origin.substring(0, origin.length() - 1) : origin);
return (origin.endsWith(PATH_SEPERATOR) ? origin.substring(0, origin.length() - 1) : origin);
}

/**
Expand Down