Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Shuttle.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
"zh-Hans",
Base,
Expand Down Expand Up @@ -454,7 +455,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Shuttle/Shuttle-Prefix.pch";
INFOPLIST_FILE = "Shuttle/Shuttle-Info.plist";
MACOSX_DEPLOYMENT_TARGET = 10.9;
MACOSX_DEPLOYMENT_TARGET = 10.13;
PRODUCT_BUNDLE_IDENTIFIER = "shuttle.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
Expand All @@ -470,7 +471,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Shuttle/Shuttle-Prefix.pch";
INFOPLIST_FILE = "Shuttle/Shuttle-Info.plist";
MACOSX_DEPLOYMENT_TARGET = 10.9;
MACOSX_DEPLOYMENT_TARGET = 10.13;
PRODUCT_BUNDLE_IDENTIFIER = "shuttle.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
Expand Down
24 changes: 22 additions & 2 deletions Shuttle/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,22 @@ - (void) separatorSortRemoval:(NSString *)currentName {
}
}

// Determines whether a shuttle entry should be treated as a URL (e.g. vnc://, ssh://,
// http://) versus a shell command to run in Terminal/iTerm. A real URL never contains
// unescaped whitespace, so that's a more reliable signal than scheme alone: NSURL's
// parser has become considerably more lenient over time (and its exact behavior is
// gated on the SDK the binary is linked against), so plain shell commands like
// "ssh user@host" can now parse into a non-nil NSURL on current macOS/Xcode even
// though they never did in 2016. Checking for whitespace first avoids misrouting
// commands to -openURL: while still preserving legitimate scheme-based entries.
- (NSURL *) urlForEntry:(NSString *)entry {
if ([entry rangeOfCharacterFromSet:[NSCharacterSet whitespaceCharacterSet]].location != NSNotFound) {
return nil;
}
NSURL *url = [NSURL URLWithString:entry];
return url.scheme.length ? url : nil;
}

- (void) openHost:(NSMenuItem *) sender {
//NSLog(@"sender: %@", sender);
//NSLog(@"Command: %@",[sender representedObject]);
Expand Down Expand Up @@ -558,7 +574,7 @@ - (void) openHost:(NSMenuItem *) sender {
NSURL *url;
if ( ![terminalWindow isEqualToString:@"virtual"] ) {
passParameters = @[escapedObject, terminalTheme, terminalTitle];
url = [NSURL URLWithString:escapedObject];
url = [self urlForEntry:escapedObject];
}
else {
passParameters = @[escapedObject, terminalTitle];
Expand Down Expand Up @@ -700,7 +716,11 @@ - (void) runScript:(NSString *)scriptPath handler:(NSString*)handlerName paramet
[containerEvent setParamDescriptor:arguments forKeyword:keyDirectObject];
}
//Execute the event
[appleScript executeAppleEvent:containerEvent error:nil];
NSDictionary *executionError = nil;
[appleScript executeAppleEvent:containerEvent error:&executionError];
if (executionError) {
NSLog(@"Shuttle AppleScript execution error for %@: %@", scriptPath, executionError);
}
}
}

Expand Down