Escape space on a file path

I had a simple shortcut that receives a file, asks me for a date and changes the file creation date to the asked date by running a touch -t {date} {path to file} shell command.

It was working perfectly for several months, but since a couple days it started failing. I discovered the problem is that shortcuts is not escaping spaces in the file path. Any ideas on how to fix that?

Look for text actions with the word “encode” in them, if “escape” doesn’t do it. What you’re talking about is sometimes called “percent encoding” or “url encoding”.

Here’s how it looks on iOS:

Put the path in your touch command in double quotes. Shell script paths are quoted not escaped. This goes for outside of Shortcuts too.