diff options
author | stuconnolly <stuart02@gmail.com> | 2011-08-07 18:42:51 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2011-08-07 18:42:51 +0000 |
commit | d01474532b11014019d4d5a1197a8f8f7d683c0b (patch) | |
tree | fc22b25c8ba23b21490673b416ce9064c77ed524 /Source/SPConnectionController.m | |
parent | 8a77a195fa6ce3aad15857a2213011bf0e8d7bd5 (diff) | |
download | sequelpro-d01474532b11014019d4d5a1197a8f8f7d683c0b.tar.gz sequelpro-d01474532b11014019d4d5a1197a8f8f7d683c0b.tar.bz2 sequelpro-d01474532b11014019d4d5a1197a8f8f7d683c0b.zip |
Don't allow newlines in the connection view input fields. Fixes issue #1008.
Diffstat (limited to 'Source/SPConnectionController.m')
-rw-r--r-- | Source/SPConnectionController.m | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Source/SPConnectionController.m b/Source/SPConnectionController.m index a5021206..937cb521 100644 --- a/Source/SPConnectionController.m +++ b/Source/SPConnectionController.m @@ -59,6 +59,7 @@ static NSString *SPExportFavoritesFilename = @"SequelProFavorites.plist"; - (NSNumber *)_createNewFavoriteID; - (SPTreeNode *)_favoriteNodeForFavoriteID:(NSInteger)favoriteID; +- (NSString *)_stripInvalidCharactersFromString:(NSString *)subject; - (void)_updateFavoritePasswordsFromField:(NSControl *)control; @@ -1396,6 +1397,17 @@ static NSComparisonResult compareFavoritesUsingKey(id favorite1, id favorite2, v } /** + * Strips any invalid characters form the supplied string. Invalid is defined as any characters that should + * not be allowed to be enetered on the connection screen. + */ +- (NSString *)_stripInvalidCharactersFromString:(NSString *)subject +{ + NSString *result = [subject stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; + + return [result stringByReplacingOccurrencesOfString:@"\n" withString:@""]; +} + +/** * Check all fields used in the keychain names against the old values for that * favorite, and update the keychain names to match if necessary. * If an (optional) recognised password field is supplied, that field is assumed |