mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Do not decode a non-JSON value (#3859)
None of the other task modifications (modify, prepend, append) treat the input as JSON, so this one shouldn't either. This works around https://github.com/GothenburgBitFactory/libshared/issues/95
This commit is contained in:
parent
7be313e91f
commit
b4e25fe42f
2 changed files with 6 additions and 4 deletions
|
@ -928,7 +928,7 @@ void Task::addAnnotation(const std::string& description) {
|
||||||
++now;
|
++now;
|
||||||
} while (has(key));
|
} while (has(key));
|
||||||
|
|
||||||
data[key] = json::decode(description);
|
data[key] = description;
|
||||||
++annotation_count;
|
++annotation_count;
|
||||||
recalc_urgency = true;
|
recalc_urgency = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,21 +67,23 @@ class TestBug268(TestCase):
|
||||||
self.assertIn("a/b or c", out)
|
self.assertIn("a/b or c", out)
|
||||||
|
|
||||||
|
|
||||||
class TestBug880(TestCase):
|
class TestBug3858(TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
"""Executed before each test in the class"""
|
"""Executed before each test in the class"""
|
||||||
self.t = Task()
|
self.t = Task()
|
||||||
|
|
||||||
def test_backslash_at_eol(self):
|
def test_backslash_at_eol(self):
|
||||||
"""880: Backslash at end of description/annotation causes problems"""
|
"""880: Backslashes at end of description/annotation are handled correctly"""
|
||||||
self.t(r"add one\\")
|
self.t(r"add one\\")
|
||||||
code, out, err = self.t("_get 1.description")
|
code, out, err = self.t("_get 1.description")
|
||||||
self.assertEqual("one\\\n", out)
|
self.assertEqual("one\\\n", out)
|
||||||
|
|
||||||
self.t(r"1 annotate 'two\\'")
|
self.t(r"1 annotate 'two\'")
|
||||||
|
self.t(r"1 annotate 'three\\'")
|
||||||
code, out, err = self.t("info rc.verbose:nothing")
|
code, out, err = self.t("info rc.verbose:nothing")
|
||||||
self.assertIn("one\\\n", out)
|
self.assertIn("one\\\n", out)
|
||||||
self.assertIn("two\\\n", out)
|
self.assertIn("two\\\n", out)
|
||||||
|
self.assertIn("three\\\\\n", out)
|
||||||
|
|
||||||
|
|
||||||
class TestBug1436(TestCase):
|
class TestBug1436(TestCase):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue