Commit graph

27 commits

Author SHA1 Message Date
Tomas Babej
ded46f8ad8 doc: Update copyright to 2021 2021-05-10 21:43:26 +02:00
Thomas Lauf
0937e80274 Update Copyright
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2021-05-10 21:43:26 +02:00
Thomas Lauf
d999fcfa37 Set python version explicitly to python3
- Closes #259

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2021-05-10 21:43:26 +02:00
Thomas Lauf
5e04aff3db Process task annotate
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2021-05-10 21:43:26 +02:00
Thomas Lauf
cc24ea76fb Small refactoring
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2021-05-10 21:43:26 +02:00
Thomas Lauf
38ddeec03c Fix for task delete
- `task delete` does add 'end' to modified JSON but not remove key 'start'
- Stop time tracking when task is deleted

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2021-05-10 21:43:26 +02:00
Thomas Lauf
f375654523 Make hook run in both python 2 and 3
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2021-05-10 21:43:26 +02:00
Dennis Schridde
4af061abda on-modify.timewarrior: Deal with non-UTF-8 characters in input data from taskwarrior
When input data from taskwarrior (e.g. via bugwarrior) contains UTF-8-illegal characters, `on-modify.timewarrior` would fail:
```
Traceback (most recent call last):
  File "$HOME/.task/hooks/on-modify.timewarrior", line 42, in <module>
    old = json.loads(sys.stdin.readline())
  File "/usr/lib/python3.6/codecs.py", line 321, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xed in position 1042: invalid continuation byte
```

This is fixed by manually decoding from stdin's underlying binary I/O object and replacing encoding errors with the Unicode replacement character [1].

[1]: https://docs.python.org/3/library/codecs.html#error-handlers
2021-05-10 21:43:26 +02:00
Dennis Schridde
9f8a4c8161 Fix on-modify.timewarrior hook for tasks with multi line description
If the description contained multiple lines, it would be formatted as a
bytes object, including Python's `b""` marker for byte literals and any
newlines.  This would then be passed literally to `timew`, which would
then choke on it, because it would record the newlines in its database.

This patch simply gets rid of the string join/split operations and the
encoding, which solves the issue.

Since we pass arrays instead of strings to `subprocess.call`, we are not
subject to command injection security vulnerabilities.

Fixes: 0b6dbf7e12d30fc791a524501e3483989a092a8c
2021-05-10 21:43:26 +02:00
Dennis Schridde
1e46ca5888 on-modify.timewarrior: Fix "from __future__ imports must occur at the beginning of the file"
Fixes the following error with Python 3.6.8:
```
  File "$HOME/.task/hooks/on-modify.timewarrior", line 33
    from __future__ import print_function
SyntaxError: from __future__ imports must occur at the beginning of the file
```
2021-05-10 21:43:26 +02:00
Thomas Lauf
c15cfcadd4 Make on-modify.timewarrior executable so tests will work 2021-05-10 21:43:26 +02:00
quazgar
7160e4f65b MAINT: Removing comment. 2021-05-10 21:43:26 +02:00
quazgar
21e55a3ee5 MAINT: on-modify.timewarrior imports from future
This should fix #216.

Untested commit.
2021-05-10 21:43:26 +02:00
Harish Ved
0a08541161 ReviewFixes: Reset tags instead of stop/start task; formatting changes 2021-05-10 21:43:26 +02:00
Harish Ved
7f10219760 Handling modifications to description/tag/project for task
The taskwarrior extension script `on-modify.timewarrior` did not forward
modifications for description/tag/project to `timew`.

This resulted in non-existent tasks (with old tag etc) contiued to be
tracked and not updated

[Closes #105](https://github.com/GothenburgBitFactory/timewarrior/issues/105)
2021-05-10 21:43:26 +02:00
Thomas Lauf
18eb53bc4a TI-94 #98 Fix Command Injection Security Vulnerability in on-modify.timewarrior
- Thanks to Aaron Fields
- Add unit test?
- What about missing ```if '.' in project:```?
2021-05-10 21:43:26 +02:00
Simon Ruderich
f026056230 Use https:// link for opensource.org 2021-05-10 21:43:26 +02:00
Paul Beckingham
4c7fec1525 TI-32: taskwarrior hook script doesn't stop recording waiting task
- Thanks to Yury Videneev.
2021-05-10 21:43:26 +02:00
Thomas Lauf
75be890476 extensions: Make extensions conform with PEP8 2021-05-10 21:43:26 +02:00
Paul Beckingham
339b849fff TI-48: Timewarrior hook is not Python3 compatible
- Thanks to Josh Proehl, Armado Martinez.
2021-05-10 21:43:26 +02:00
Paul Beckingham
5d91528598 TI-51: in the taskwarrior hook, deleting a task doesn't stop the watch
- Thanks to Mattia Rizzolo.
2021-05-10 21:43:26 +02:00
Paul Beckingham
2de2ecd440 Ext: Taskwarrior project handling
- Taskwarrior projects are now used as-is as tags, and also split on the '.' to
  represent project hierarchy as separate tags.
- Thanks to Josh Proehl.
2021-05-10 21:43:26 +02:00
Paul Beckingham
99d2d12f37 Ext: Fixed utf8 encoding in Taskwarrior integration hook
- Thanks to Martin Boeker.
2021-05-10 21:43:26 +02:00
Paul Beckingham
8f532d8eb9 TI-16: Should handle case where taskwarrior hook is used before timew
- Thanks to Aaron Curtis.
2021-05-10 21:43:26 +02:00
Paul Beckingham
35530d75e4 Ext: Removed UUID from hook script 2021-05-10 21:43:26 +02:00
Paul Beckingham
7f439e20ee Extensions: Added Taskwarrior integration hook
- This first draft hook script uses the task UUID, description, project and tags
  as Timewarrior tags, and responds to 'task <id> start' and 'task <id> stop'
  commands, as well as other changes that have the same effect.
2021-05-10 21:43:26 +02:00
Paul Beckingham
d995d7ba7b Ext: Added initial extensions and README 2021-05-10 21:43:25 +02:00