Skip to content

Commit db448f9

Browse files
committed
kv-store: support quoted values
In the case of the value contains whitespaces, it has to be surrounded with quotes (single or double). We should exclude these characters from the final values. Signed-off-by: Mathieu Tortuyaux <mtortuyaux@microsoft.com>
1 parent e883ea5 commit db448f9

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/update_engine/simple_key_value_store.cc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,14 @@ map<std::string, std::string> ParseString(const string& str) {
2727
string::size_type pos = it->find('=');
2828
if (pos == string::npos)
2929
continue;
30-
ret[it->substr(0, pos)] = it->substr(pos + 1);
30+
string val = it->substr(pos + 1);
31+
if ((val.length() >= 2) &&
32+
((val.front() == '\"' && val.back() == '\"') ||
33+
(val.front() == '\'' && val.back() == '\''))) {
34+
val = val.substr(1, val.length() - 2);
35+
}
36+
37+
ret[it->substr(0, pos)] = val;
3138
}
3239
return ret;
3340
}

0 commit comments

Comments
 (0)