Wrong URL Encoding for files opened via Semantic History
Thanks for filing an issue! Please answer the questions below so I can help you.
- iTerm2 version: 3.3.11beta1
- OS version: 10.15.5 (19F101)
- MacVim version: 8.2.539 (163)
- debuglog1.txt
Detailed steps to reproduce the problem:
- Set "Open with editor…" -> "MacVim" in Preferences -> Profiles -> Default -> Advanced -> Semantic History
- CMD+Click a filename in the output of "ls"
What happened: MacVim launched, but doesn't open the clicked file.
What should have happened: MacVim should open the clicked file in a new window.
Looking at the debuglog.txt reveals that iTerm2 is trying to open the URL mvim://open?url=file://%2FUsers%2Ffelix%2Fdev%2Fsites%2Fexample%2FGemfile
instead of the expected mvim://open?url=file:///Users/felix/dev/sites/example/Gemfile
.
Trying to run open mvim://open?url=file://%2FUsers%2Ffelix%2Fdev%2Fsites%2Fexample%2FGemfile
in the terminal has the same effect: no file is opened in MacVim.
Trying to run mvim://open?url=file:///Users/felix/dev/sites/example/Gemfile
works, opening the file in a new window.
Also trying to open a file with spaces using eg. mvim://open?url=file:///Users/felix/foo%20bar.txt
works fine.
This shows that MacVim does not accept file URLs with percent encoded slashes.
Inspecting the iTermSemanticHistoryController.m source code reveals that it incorrectly uses URLHostAllowedCharacterSet
instead of the proper URLPathAllowedCharacterSet
.
I have already verified that the problem is fixed by using URLPathAllowedCharacterSet
and will submit a pull request on GitHub with a reference to this issue.