From 68cbec7a82e80f76b30fcaf9b7b1ba655abb2a11 Mon Sep 17 00:00:00 2001 From: xzyfer Date: Thu, 22 Sep 2016 21:09:40 +1000 Subject: [PATCH 1/2] Revert "Allow unicode chars in unquoted urls" This reverts commit db1d56b064920daaea5e26a131ba85e6a05d4909. --- src/lexer.cpp | 7 +++---- src/parser.cpp | 4 ++++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/lexer.cpp b/src/lexer.cpp index cb77cdbf42..f9ae07c7c4 100644 --- a/src/lexer.cpp +++ b/src/lexer.cpp @@ -88,12 +88,11 @@ namespace Sass { } // check if char is within a reduced ascii range - // valid in a uri (and also unicode octets) + // valid in a uri (copied from Ruby Sass) bool is_uri_character(const char& chr) { - return unsigned(chr) > 41 || - unsigned(chr) == ':' || - unsigned(chr) == '/'; + return (unsigned(chr) > 41 && unsigned(chr) < 127) || + unsigned(chr) == ':' || unsigned(chr) == '/'; } // check if char is within a reduced ascii range diff --git a/src/parser.cpp b/src/parser.cpp index 89e0670fca..492ee7b8fe 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -316,6 +316,10 @@ namespace Sass { else if (String* the_url = parse_url_function_argument()) { *args << SASS_MEMORY_NEW(ctx.mem, Argument, the_url->pstate(), the_url); } + else if (peek < skip_over_scopes < exactly < '(' >, exactly < ')' > > >(position)) { + Expression* the_url = parse_list(); // parse_interpolated_chunk(lexed); + *args << SASS_MEMORY_NEW(ctx.mem, Argument, the_url->pstate(), the_url); + } else { error("malformed URL", pstate); } From 7959cad4b6ff5751572423d7b70be2e97913a577 Mon Sep 17 00:00:00 2001 From: xzyfer Date: Thu, 22 Sep 2016 21:41:30 +1000 Subject: [PATCH 2/2] Fix nonascii regex to match Ruby Sass --- src/lexer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lexer.cpp b/src/lexer.cpp index f9ae07c7c4..464ca444ac 100644 --- a/src/lexer.cpp +++ b/src/lexer.cpp @@ -81,9 +81,9 @@ namespace Sass { bool is_nonascii(const char& chr) { return ( - (unsigned(chr) > 127 && unsigned(chr) < 55296) || - (unsigned(chr) > 57343 && unsigned(chr) < 65534) || - (unsigned(chr) > 65535 && unsigned(chr) < 1114111) + (unsigned(chr) >= 128 && unsigned(chr) <= 15572911) || + (unsigned(chr) >= 15630464 && unsigned(chr) <= 15712189) || + (unsigned(chr) >= 4036001920) ); }