From 9df030ba55101db4a3a35c301769655d6fa7aa08 Mon Sep 17 00:00:00 2001 From: Haijian Wang Date: Wed, 2 Jan 2013 16:54:11 +0200 Subject: [PATCH] fix Ticket #10506, remove quotes in url path taking single quote into consideration Change-Id: I966ffeba8a60c7c16980cca3dfa69935e0aca67b --- .../com/vaadin/sass/internal/visitor/ImportNodeHandler.java | 4 +++- theme-compiler/tests/resources/automatic/css/url-path.css | 5 +++++ theme-compiler/tests/resources/automatic/scss/foo/bar.scss | 5 +++++ theme-compiler/tests/resources/automatic/scss/url-path.scss | 1 + 4 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 theme-compiler/tests/resources/automatic/css/url-path.css create mode 100644 theme-compiler/tests/resources/automatic/scss/foo/bar.scss create mode 100644 theme-compiler/tests/resources/automatic/scss/url-path.scss diff --git a/theme-compiler/src/com/vaadin/sass/internal/visitor/ImportNodeHandler.java b/theme-compiler/src/com/vaadin/sass/internal/visitor/ImportNodeHandler.java index 1ba1072767..67e6df6383 100644 --- a/theme-compiler/src/com/vaadin/sass/internal/visitor/ImportNodeHandler.java +++ b/theme-compiler/src/com/vaadin/sass/internal/visitor/ImportNodeHandler.java @@ -100,7 +100,9 @@ public class ImportNodeHandler { LexicalUnit value = ((RuleNode) child).getValue(); while (value != null) { if (value.getLexicalUnitType() == LexicalUnit.SAC_URI) { - String path = value.getStringValue(); + String path = value.getStringValue() + .replaceAll("^\"|\"$", "") + .replaceAll("^'|'$", ""); if (!path.startsWith("/") && !path.contains(":")) { path = prefix + path; path = StringUtil.cleanPath(path); diff --git a/theme-compiler/tests/resources/automatic/css/url-path.css b/theme-compiler/tests/resources/automatic/css/url-path.css new file mode 100644 index 0000000000..1045948ac8 --- /dev/null +++ b/theme-compiler/tests/resources/automatic/css/url-path.css @@ -0,0 +1,5 @@ +.bar { + background: url(foo/lorem.png); + background: url(foo/lorem.png); + background: url(foo/lorem.png); +} \ No newline at end of file diff --git a/theme-compiler/tests/resources/automatic/scss/foo/bar.scss b/theme-compiler/tests/resources/automatic/scss/foo/bar.scss new file mode 100644 index 0000000000..326d34232d --- /dev/null +++ b/theme-compiler/tests/resources/automatic/scss/foo/bar.scss @@ -0,0 +1,5 @@ +.bar { + background: url("lorem.png"); + background: url('lorem.png'); + background: url(lorem.png); +} \ No newline at end of file diff --git a/theme-compiler/tests/resources/automatic/scss/url-path.scss b/theme-compiler/tests/resources/automatic/scss/url-path.scss new file mode 100644 index 0000000000..0cc954bfb4 --- /dev/null +++ b/theme-compiler/tests/resources/automatic/scss/url-path.scss @@ -0,0 +1 @@ +@import "foo/bar.scss"; \ No newline at end of file -- 2.39.5