update creator window error parsing to be a bit more expandable (in terms of checking for "http")

This commit is contained in:
Mitchell Livingston 2008-04-22 04:00:17 +00:00
parent 29b0b33663
commit 3f198f365d
1 changed files with 4 additions and 2 deletions

View File

@ -204,10 +204,12 @@
[alert setAlertStyle: NSWarningAlertStyle];
//check common reasons for failure
if (![trackerString hasPrefix: @"http://"])
NSRange prefixRange = [trackerString rangeOfString: @"://"];
NSString * prefix = [trackerString substringToIndex: prefixRange.location];
if ([prefix caseInsensitiveCompare: @"http"] != NSOrderedSame)
[alert setMessageText: NSLocalizedString(@"The tracker address must begin with \"http://\".",
"Create torrent -> warning -> message")];
else if ([trackerString length] == 7) //don't allow blank addresses
else if ([trackerString length] == NSMaxRange(prefixRange)) //don't allow blank addresses
[alert setMessageText: NSLocalizedString(@"The tracker address cannot be blank.", "Create torrent -> warning -> message")];
else
[alert setMessageText: NSLocalizedString(@"The tracker address is invalid.", "Create torrent -> warning -> message")];