mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-14 08:12:28 +00:00
Merge pull request #216 from jamesrhurst/escape-url
Percent escape strings before creating URLs
This commit is contained in:
@@ -616,10 +616,10 @@ NSString *const _MPTAbleSecurCellView = @"PasswordCell";
|
|||||||
- (void)openURL:(id)sender {
|
- (void)openURL:(id)sender {
|
||||||
KPKEntry *selectedEntry = [self _clickedOrSelectedEntry];
|
KPKEntry *selectedEntry = [self _clickedOrSelectedEntry];
|
||||||
if(selectedEntry && [selectedEntry.url length] > 0) {
|
if(selectedEntry && [selectedEntry.url length] > 0) {
|
||||||
NSURL *webURL = [NSURL URLWithString:selectedEntry.url];
|
NSURL *webURL = [NSURL URLWithString:[selectedEntry.url stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
|
||||||
NSString *scheme = [webURL scheme];
|
NSString *scheme = [webURL scheme];
|
||||||
if(!scheme) {
|
if(!scheme) {
|
||||||
webURL = [NSURL URLWithString:[NSString stringWithFormat:@"http://%@", selectedEntry.url]];
|
webURL = [NSURL URLWithString:[NSString stringWithFormat:@"http://%@", [selectedEntry.url stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]];
|
||||||
}
|
}
|
||||||
[[NSWorkspace sharedWorkspace] openURL:webURL];
|
[[NSWorkspace sharedWorkspace] openURL:webURL];
|
||||||
/* Add custom browser support */
|
/* Add custom browser support */
|
||||||
|
|||||||
Reference in New Issue
Block a user