Skip to content

Commit

Permalink
Disallow non-string argument to quote
Browse files Browse the repository at this point in the history
  • Loading branch information
glebm committed Apr 13, 2019
1 parent bfa4472 commit 4fb4afb
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/fn_strings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,20 +65,12 @@ namespace Sass {
Signature quote_sig = "quote($string)";
BUILT_IN(sass_quote)
{
AST_Node_Obj arg = env["$string"];
// only set quote mark to true if already a string
if (String_Quoted* qstr = Cast<String_Quoted>(arg)) {
qstr->quote_mark('*');
return qstr;
}
// all other nodes must be converted to a string node
std::string str(quote(arg->to_string(ctx.c_options), '"'));
String_Quoted* result = SASS_MEMORY_NEW(String_Quoted, pstate, str);
const String_Constant* s = ARG("$string", String_Constant);
String_Quoted* result = SASS_MEMORY_NEW(String_Quoted, pstate, s->value(), '"');
result->quote_mark('*');
return result;
}


Signature str_length_sig = "str-length($string)";
BUILT_IN(str_length)
{
Expand Down

0 comments on commit 4fb4afb

Please sign in to comment.