Skip to content

Fix #1020 #1021

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 17, 2020
Merged

Fix #1020 #1021

merged 1 commit into from
Mar 17, 2020

Conversation

frarees
Copy link
Contributor

@frarees frarees commented Mar 11, 2020

PR #1002 removed decoding of the mvim:// url query.
Every query goes through decoding now, no exceptions.

This should make it work the way it was.

We can use this PR to generate regression tests as well, as pointed here #1020 (comment)

@frarees frarees force-pushed the uri_encode branch 2 times, most recently from a59a183 to 66c2fcd Compare March 12, 2020 13:25
@ychin
Copy link
Member

ychin commented Mar 16, 2020

@frarees why did you remove the decoding check? This will make URI with spaces in them not work again I think. You found the bug (v = [f stringByRemovingPercentEncoding];) so I think just fixing the two lines where we erroneously assigned v to decoded f is enough to fix this issue. No need to remove the decoding check.

As for the regression test, let's add that later and fix this issue for now.

@frarees
Copy link
Contributor Author

frarees commented Mar 16, 2020

For some reason, I thought not encoding (the original fix) broke compatibility (#1020). Added it back.

@ychin
Copy link
Member

ychin commented Mar 17, 2020

Yes I think what broke was just the bug of assigning f to v which resulted in the line number not propagated over.

@ychin ychin merged commit 3b39147 into macvim-dev:master Mar 17, 2020
ychin added a commit to ychin/macvim that referenced this pull request Jul 6, 2020
Change mvim:// protocol behavior back to previous state to double-encode
the file path, since we are encapsulating a file:// protocol (which has
encoded path) within another URL as a query, which itself should be
encoded. This means a file path "/tmp/file name.txt" should be properly
encoded as mvim://open?url=file:///tmp/file%2520name.txt, as the space
is encoded twice (first to %20, then to %2520).

Previously we tried to fix the protocol handler to only do a single
encoding (see macvim-dev#1021 and macvim-dev#1043) but it's really an incorrect usage of
URL. The reason for that fix was that tools like iTerm2 was passing in
single-encoded URLs. As such, also add a compatibility feature here
where we will optimiscally try to re-encode characters that we detect to
be erroneously encoded. For example, if we see
mvim://open?url=file:///tmp/file%20name.txt, MacVim will intelligently
realize that the space needs to be encoded again. The only character
where that won't work is the "%" character because of the ambiguity
involved, so a file path "/tmp/file%.txt" will only work with this:
mvim://open?url=file:///tmp/file%2525.txt

Close macvim-dev#1020 (also see the issue for discussions).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants