From b5653011864ee88dadc38900fda6e936e635defd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mi=C5=A1ko=20Hevery?= Date: Fri, 10 Feb 2017 18:23:58 -0600 Subject: [PATCH] fix(compiler): REVERT allow absolute style urls (#14365) This reverts commit 6b9aa2ca3dd6cacb8c010406596f715eec6fddbd. --- modules/@angular/compiler/src/style_url_resolver.ts | 2 +- modules/@angular/compiler/test/style_url_resolver_spec.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/@angular/compiler/src/style_url_resolver.ts b/modules/@angular/compiler/src/style_url_resolver.ts index c9d43c7bb6..1f2bbb5dd6 100644 --- a/modules/@angular/compiler/src/style_url_resolver.ts +++ b/modules/@angular/compiler/src/style_url_resolver.ts @@ -16,7 +16,7 @@ export class StyleWithImports { } export function isStyleUrlResolvable(url: string): boolean { - if (!url) return false; + if (url == null || url.length === 0 || url[0] == '/') return false; const schemeMatch = url.match(URL_WITH_SCHEMA_REGEXP); return schemeMatch === null || schemeMatch[1] == 'package' || schemeMatch[1] == 'asset'; } diff --git a/modules/@angular/compiler/test/style_url_resolver_spec.ts b/modules/@angular/compiler/test/style_url_resolver_spec.ts index 94315261fa..819ad7d0a6 100644 --- a/modules/@angular/compiler/test/style_url_resolver_spec.ts +++ b/modules/@angular/compiler/test/style_url_resolver_spec.ts @@ -110,9 +110,9 @@ export function main() { it('should not resolve urls with other schema', () => { expect(isStyleUrlResolvable('http://otherurl')).toBe(false); }); - it('should resolve urls with absolute paths', () => { - expect(isStyleUrlResolvable('/otherurl')).toBe(true); - expect(isStyleUrlResolvable('//otherurl')).toBe(true); + it('should not resolve urls with absolute paths', () => { + expect(isStyleUrlResolvable('/otherurl')).toBe(false); + expect(isStyleUrlResolvable('//otherurl')).toBe(false); }); }); }