Bug
- Fixed bug that required the '%YAML' prologue in a YAML import.
This commit is contained in:
@@ -80,9 +80,15 @@ static fileType determineFileType (const std::vector <std::string>& lines)
|
||||
return task_1_4_3;
|
||||
}
|
||||
|
||||
if (lines.size () > 2 &&
|
||||
lines[0] == "%YAML 1.1" &&
|
||||
lines[1] == "---")
|
||||
if ((lines.size () > 2 &&
|
||||
lines[0] == "%YAML 1.1" &&
|
||||
lines[1] == "---")
|
||||
||
|
||||
(lines.size () > 3 &&
|
||||
(lines[0].find ("task:") != std::string::npos ||
|
||||
lines[1].find ("task:") != std::string::npos ||
|
||||
lines[2].find ("task:") != std::string::npos ||
|
||||
lines[3].find ("task:") != std::string::npos)))
|
||||
{
|
||||
return yaml;
|
||||
}
|
||||
@@ -1249,6 +1255,23 @@ static std::string importYAML (const std::vector <std::string>& lines)
|
||||
t.set (name, value);
|
||||
}
|
||||
|
||||
if (t.size ())
|
||||
{
|
||||
// Generate a UUID if not present.
|
||||
if (t.get ("uuid") == "")
|
||||
t.set ("uuid", uuid ());
|
||||
|
||||
// Add defaults.
|
||||
decorateTask (t);
|
||||
t.setStatus (status);
|
||||
|
||||
// TODO Fail on UUID collision.
|
||||
|
||||
context.tdb.add (t);
|
||||
t.clear ();
|
||||
++count;
|
||||
}
|
||||
|
||||
context.tdb.commit ();
|
||||
context.tdb.unlock ();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user