naggie / dstask

Git powered terminal-based todo/note manager -- markdown note page per task. Single binary!
https://calbryant.uk/blog/dstask-a-taskwarrior-alternative/
MIT License
793 stars 47 forks source link

Encode Task ID and Summary in EDITOR tempfile #160

Closed dontlaugh closed 2 years ago

dontlaugh commented 2 years ago

Introduce a new utility function (and unit test) for generated truncated filenames from task ID and summary.

Go strings are UTF-8, and there may be pathological inputs that we need to sanitize. Add these to the unit test and handle them as we find them.

Fixes #117

dontlaugh commented 2 years ago

A screenshot of the encoded summary and task id image

naggie commented 2 years ago

I think we should run the task name through a whitelist filter and drop any characters not on the list. Also, convert spaces to dashes, and normalise to lowercase. Numbers and a-z should bring enough information over.

dontlaugh commented 2 years ago

@naggie Ready for review!

naggie commented 2 years ago

Thanks @dontlaugh. Nitpicking --- but if we filter characters that aren't in the whitelist we don't end up with repeated dashes; would you mind changing it so we don't get repeated dashes please?

dontlaugh commented 2 years ago

@naggie Fixed, I think. I've updated the test cases. Take a look at those to see the current behavior.

naggie commented 2 years ago

Thanks @dontlaugh !