diff --git a/XXXApolloOpener.m b/XXXApolloOpener.m index 8723c57..058f892 100644 --- a/XXXApolloOpener.m +++ b/XXXApolloOpener.m @@ -18,19 +18,19 @@ - (instancetype)init { } - (id)openURL:(NSURL *)url sender:(NSString *)sender { - - if ([url.host isEqualToString:@"www.reddit.com"] || - [url.host isEqualToString:@"reddit.com"] || - [url.host isEqualToString:@"m.reddit.com"] || - [url.host isEqualToString:@"old.reddit.com"] || - [url.host containsString:@".reddit.com"]) { - - if ([url.path isEqualToString:@"/"]) { - return [NSURL URLWithString:@"apollo://"]; - } else { - return [NSURL URLWithString:[NSString stringWithFormat:@"apollo://reddit.com%@/?%@", url.path, url.query]]; - } - } + + if ([url.host isEqualToString:@"www.reddit.com"] || + [url.host isEqualToString:@"reddit.com"] || + [url.host isEqualToString:@"m.reddit.com"] || + [url.host isEqualToString:@"old.reddit.com"] || + [url.host containsString:@".reddit.com"]) { + + if ([url.path isEqualToString:@"/"] || [url.path isEqualToString:@""]) { + return [NSURL URLWithString:@"apollo://"]; + } else { + return [NSURL URLWithString:[NSString stringWithFormat:@"apollo://reddit.com%@/?%@", url.path, url.query]]; + } + } return nil; }