even better url completion
This commit is contained in:
parent
95cbdc4900
commit
543d2f0037
|
@ -728,20 +728,19 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
|
||||||
if (![urlString isEqualToString: @""])
|
if (![urlString isEqualToString: @""])
|
||||||
{
|
{
|
||||||
if ([urlString rangeOfString: @"://"].location == NSNotFound)
|
if ([urlString rangeOfString: @"://"].location == NSNotFound)
|
||||||
urlString = [@"http://" stringByAppendingString: urlString];
|
{
|
||||||
|
|
||||||
if ([urlString rangeOfString: @"."].location == NSNotFound)
|
if ([urlString rangeOfString: @"."].location == NSNotFound)
|
||||||
{
|
{
|
||||||
int start = NSMaxRange([urlString rangeOfString: @"://"]);
|
|
||||||
int beforeCom;
|
int beforeCom;
|
||||||
if ((beforeCom = [urlString rangeOfString: @"/" options: 0
|
if ((beforeCom = [urlString rangeOfString: @"/"].location) != NSNotFound)
|
||||||
range: NSMakeRange(start, [urlString length] - start)].location) != NSNotFound)
|
urlString = [NSString stringWithFormat: @"http://www.%@.com/%@",
|
||||||
urlString = [NSString stringWithFormat: @"%@www.%@.com/%@", [urlString substringToIndex: start],
|
[urlString substringToIndex: beforeCom],
|
||||||
[urlString substringWithRange: NSMakeRange(start, beforeCom - start)],
|
|
||||||
[urlString substringFromIndex: beforeCom + 1]];
|
[urlString substringFromIndex: beforeCom + 1]];
|
||||||
else
|
else
|
||||||
urlString = [NSString stringWithFormat: @"%@www.%@.com", [urlString substringToIndex: start],
|
urlString = [NSString stringWithFormat: @"http://www.%@.com", urlString];
|
||||||
[urlString substringFromIndex: start]];
|
}
|
||||||
|
else
|
||||||
|
urlString = [@"http://" stringByAppendingString: urlString];
|
||||||
}
|
}
|
||||||
|
|
||||||
NSURL * url = [NSURL URLWithString: urlString];
|
NSURL * url = [NSURL URLWithString: urlString];
|
||||||
|
|
Loading…
Reference in New Issue