Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

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 15, 2019
1 parent 9740de6 commit 5ae2e81
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/fn_strings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,20 +65,14 @@ 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(),
/*q=*/'\0', /*keep_utf8_escapes=*/false, /*skip_unquoting=*/true);
result->quote_mark('*');
return result;
}


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

0 comments on commit 5ae2e81

Please sign in to comment.