vitorgalvao / alfred-workflows

Collection of Alfred workflows
BSD 3-Clause "New" or "Revised" License
2.44k stars 167 forks source link

MarkdownTransform: Escape multimarkdown_bin path to handle spaces #128

Closed mr-pennyworth closed 3 years ago

mr-pennyworth commented 3 years ago

Fixes #127

vitorgalvao commented 3 years ago

Thank you! This was an unexpected bug, as I always care to test for spaces and weird characters, though them being in the path of the Workflow explains the miss.

However, I prefer a shorter fix which doesn’t require shellwords. The crux of the issue is that if the code you give Open3 or system is a single item, they’ll need to invoke a shell to interpret it, thus requiring the escaping (because otherwise how would it know where you meant to split things). But if it’s more than one item, they can invoke the utility directly.

The solution, then, is to never invoke system and friends with a single argument. -- usually does the trick, as in most tools it means “stop interpreting command flags starting here”.

But thank you again for the PR and bringing this to my attention!