Don't double-encode URLs before parsing them

<https://code.google.com/p/macvim/issues/detail?id=316> wasn't a bug.

When you're constructing a URL, you *should* end up escaping URL-unsafe
characters twice: once for the `file:` URL and once for the `mvim:` URL.
Escaping it inside MacVim breaks legit URLs with escapes at the `mvim:` level.
This commit is contained in:
Sidney San Martín
2013-07-17 14:26:49 -04:00
parent 44cb070245
commit fe5039c278
+3 -6
View File
@@ -1659,12 +1659,9 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
- (void)handleGetURLEvent:(NSAppleEventDescriptor *)event
replyEvent:(NSAppleEventDescriptor *)reply
{
NSString *urlString = [[event paramDescriptorForKeyword:keyDirectObject]
stringValue];
// NOTE: URLWithString requires string to be percent escaped.
urlString = [urlString stringByAddingPercentEscapesUsingEncoding:
NSUTF8StringEncoding];
NSURL *url = [NSURL URLWithString:urlString];
NSURL *url = [NSURL URLWithString:[[event
paramDescriptorForKeyword:keyDirectObject]
stringValue]];
// We try to be compatible with TextMate's URL scheme here, as documented
// at http://blog.macromates.com/2007/the-textmate-url-scheme/ . Currently,