Skip to content
New issue

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

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

Already on GitHub? # to your account

Fix parsing for urls with unicode characters #2184

Merged
merged 2 commits into from
Sep 22, 2016
Merged
Show file tree
Hide file tree
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
13 changes: 6 additions & 7 deletions src/lexer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,19 +81,18 @@ 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)
);
}

// 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
Expand Down
4 changes: 4 additions & 0 deletions src/parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down