mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-27 17:49:02 +00:00
Allow protocol relative URLs in CssLink Transformer
This commit allows the use of "protcol relative URLs" (i.e. URLs without scheme, starting with `//`), often used to serve resources automatically from https or http with third party domains. This syntax is allowed by RFC 3986. Issue: SPR-12632
This commit is contained in:
+2
-1
@@ -123,7 +123,8 @@ public class CssLinkResourceTransformer extends ResourceTransformerSupport {
|
||||
|
||||
private boolean hasScheme(String link) {
|
||||
int schemeIndex = link.indexOf(":");
|
||||
return schemeIndex > 0 && !link.substring(0, schemeIndex).contains("/");
|
||||
return (schemeIndex > 0 && !link.substring(0, schemeIndex).contains("/"))
|
||||
|| link.indexOf("//") == 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user