-
-
Notifications
You must be signed in to change notification settings - Fork 684
Fix mvim:// protocol double-encoding behavior handling properly #1055
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
ychin
merged 1 commit into
macvim-dev:master
from
ychin:mvim-protocol-fixes-double-encoding
Jul 6, 2020
Merged
Fix mvim:// protocol double-encoding behavior handling properly #1055
ychin
merged 1 commit into
macvim-dev:master
from
ychin:mvim-protocol-fixes-double-encoding
Jul 6, 2020
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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).
ychin
added a commit
that referenced
this pull request
Aug 13, 2020
Vim patch 8.2.1424 Features - New "Appearance" option pane (accessible via Cmd-, or MacVim -> Preferences) to allow customizing how MacVim looks. Users can now select how MacVim works with Dark Mode, and configure titlebar to be hidden or transparent. #912 #1038 #1056 - MacVim localization support. It now uses translated Vim messages for the specified locale. See `:help multilang-messages` to see how to configure it. #991 General: - Python is now built against 3.8, up from 3.7. #1012 Fixes: - Fix mvim:// protocol handler behavior. Reverts behavior back to old behavior (before snapshot-162), but add new fallback handling to try to handle poorly formed URLs that don't double-encode special characters. See `:help macvim://`. #1055 - Can now change tabs using menu and keyboard shortcuts (Cmd-{ / Cmd-} / Cmd-T) when in terminal mode. #1045 Targets macOS 10.9+ Script interfaces have compatibility with these versions: - Lua 5.3 - Perl 5.18 - Python2 2.7 - Python3 3.8 - Ruby 2.7
ychin
added a commit
to ychin/macvim
that referenced
this pull request
Aug 15, 2020
Vim patch 8.2.1456 Features - New "Appearance" option pane (accessible via Cmd-, or MacVim -> Preferences) to allow customizing how MacVim looks. Users can now select how MacVim works with Dark Mode, and configure titlebar to be hidden or transparent. macvim-dev#912 macvim-dev#1038 macvim-dev#1056 - MacVim localization support. It now uses translated Vim messages for the specified locale. See `:help multilang-messages` to see how to configure it. macvim-dev#991 General: - Python is now built against 3.8, up from 3.7. macvim-dev#1012 Fixes: - Fix mvim:// protocol handler behavior. Reverts behavior back to old behavior (before snapshot-162), but add new fallback handling to try to handle poorly formed URLs that don't double-encode special characters. See `:help macvim://`. macvim-dev#1055 - Can now change tabs using menu and keyboard shortcuts (Cmd-{ / Cmd-} / Cmd-T) when in terminal mode. macvim-dev#1045 - Fix crash during MacVim launch in Snapshot 164 (8.2.1424) due to dynamic library linkage. macvim-dev#1073 Targets macOS 10.9+ Script interfaces have compatibility with these versions: - Lua 5.3 - Perl 5.18 - Python2 2.7 - Python3 3.8 - Ruby 2.7
ychin
added a commit
that referenced
this pull request
Aug 15, 2020
Vim patch 8.2.1456 Features - New "Appearance" option pane (accessible via Cmd-, or MacVim -> Preferences) to allow customizing how MacVim looks. Users can now select how MacVim works with Dark Mode, and configure titlebar to be hidden or transparent. #912 #1038 #1056 - MacVim localization support. It now uses translated Vim messages for the specified locale. See `:help multilang-messages` to see how to configure it. #991 General: - Python is now built against 3.8, up from 3.7. #1012 Fixes: - Fix mvim:// protocol handler behavior. Reverts behavior back to old behavior (before snapshot-162), but add new fallback handling to try to handle poorly formed URLs that don't double-encode special characters. See `:help macvim://`. #1055 - Can now change tabs using menu and keyboard shortcuts (Cmd-{ / Cmd-} / Cmd-T) when in terminal mode. #1045 - Fix crash during MacVim launch in Snapshot 164 (8.2.1424) due to dynamic library linkage. #1073 Targets macOS 10.9+ Script interfaces have compatibility with these versions: - Lua 5.3 - Perl 5.18 - Python2 2.7 - Python3 3.8 - Ruby 2.7
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 #1021 and #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 #1020 (also see the issue for discussions).