Browse Source

don't prepend http:// if already exists

Signed-off-by: Felix Paul Kühne <fkuehne@videolan.org>
Jörg Bleyel 11 years ago
parent
commit
5192c7c994
1 changed files with 6 additions and 3 deletions
  1. 6 3
      Sources/VLCAppDelegate.m

+ 6 - 3
Sources/VLCAppDelegate.m

@@ -146,9 +146,12 @@
                     /* Safari & al mangle vlc://http:// so fix this */
                     /* Safari & al mangle vlc://http:// so fix this */
                     if (location != NSNotFound && [parsedString characterAtIndex:location - 1] != 0x3a) { // :
                     if (location != NSNotFound && [parsedString characterAtIndex:location - 1] != 0x3a) { // :
                             parsedString = [NSString stringWithFormat:@"%@://%@", [parsedString substringToIndex:location], [parsedString substringFromIndex:location+2]];
                             parsedString = [NSString stringWithFormat:@"%@://%@", [parsedString substringToIndex:location], [parsedString substringFromIndex:location+2]];
-                    } else
-                        parsedString = [@"http://" stringByAppendingString:[receivedUrl substringFromIndex:6]];
-
+                    } else {
+                        parsedString = [receivedUrl substringFromIndex:6];
+                        if (![parsedString hasPrefix:@"http://"] && ![parsedString hasPrefix:@"https://"] && ![parsedString hasPrefix:@"ftp://"]) {
+                            parsedString = [@"http://" stringByAppendingString:[receivedUrl substringFromIndex:6]];
+                        }
+                    }
                     url = [NSURL URLWithString:parsedString];
                     url = [NSURL URLWithString:parsedString];
                 }
                 }
             }
             }