A metadata key must occur at the beginning

Before, this was valid:

  ; Today Yesterday: Tomorrow

Which would set the key Yesterday to the value Tomorrow.  Now, it is
just an ordinary comment.
This commit is contained in:
John Wiegley 2010-06-18 02:21:02 -04:00
parent b881220987
commit 7e2547b1e4

View file

@ -166,6 +166,7 @@ void item_t::parse_tags(const char * p,
string tag;
bool by_value = false;
bool first = true;
for (char * q = std::strtok(buf.get(), " \t");
q;
q = std::strtok(NULL, " \t")) {
@ -191,7 +192,7 @@ void item_t::parse_tags(const char * p,
(*i).second.second = true;
}
}
else if (q[len - 1] == ':') { // a metadata setting
else if (first && q[len - 1] == ':') { // a metadata setting
int index = 1;
if (q[len - 2] == ':') {
by_value = true;
@ -199,6 +200,7 @@ void item_t::parse_tags(const char * p,
}
tag = string(q, len - index);
}
first = false;
}
}