Brion VIBBER has submitted this change and it was merged.
Change subject: Apply percent decoding to titles extracted from URLs
......................................................................
Apply percent decoding to titles extracted from URLs
Change-Id: If2cd04fff08a394467eb4b770e080fc80fa076da
---
M MediaWikiKit/MediaWikiKit/MWKSite.m
M MediaWikiKit/MediaWikiKitTests/MWKSiteTests.m
2 files changed, 4 insertions(+), 1 deletion(-)
Approvals:
Brion VIBBER: Looks good to me, approved
diff --git a/MediaWikiKit/MediaWikiKit/MWKSite.m
b/MediaWikiKit/MediaWikiKit/MWKSite.m
index 069b589..3377879 100644
--- a/MediaWikiKit/MediaWikiKit/MWKSite.m
+++ b/MediaWikiKit/MediaWikiKit/MWKSite.m
@@ -28,7 +28,8 @@
- (MWKTitle *)titleWithInternalLink:(NSString *)path
{
if ([path hasPrefix:localLinkPrefix]) {
- NSString *remainder = [path substringFromIndex:localLinkPrefix.length];
+ NSString *remainder = [[path substringFromIndex:localLinkPrefix.length]
+
stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
return [self titleWithString:remainder];
} else {
@throw [NSException exceptionWithName:@"SiteBadLinkFormatException"
reason:@"unexpected local link format" userInfo:nil];
diff --git a/MediaWikiKit/MediaWikiKitTests/MWKSiteTests.m
b/MediaWikiKit/MediaWikiKitTests/MWKSiteTests.m
index a396260..734b4e9 100644
--- a/MediaWikiKit/MediaWikiKitTests/MWKSiteTests.m
+++ b/MediaWikiKit/MediaWikiKitTests/MWKSiteTests.m
@@ -63,6 +63,8 @@
XCTAssertEqualObjects([site
titleWithInternalLink:@"/wiki/India"].prefixedText, @"India");
XCTAssertEqualObjects([site
titleWithInternalLink:@"/wiki/Talk:India"].prefixedText, @"Talk:India");
XCTAssertEqualObjects([site
titleWithInternalLink:@"/wiki/Talk:India#History"].prefixedText, @"Talk:India");
+ XCTAssertEqualObjects([site titleWithInternalLink:@"/wiki/2008 ACC Men%27s
Basketball Tournament"].prefixedText,
+ @"2008 ACC Men's Basketball Tournament");
// XCTAssertThrows([site titleWithInternalLink:@"/upload/foobar"]);
}
--
To view, visit https://gerrit.wikimedia.org/r/177961
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: If2cd04fff08a394467eb4b770e080fc80fa076da
Gerrit-PatchSet: 2
Gerrit-Project: apps/ios/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Sesh <[email protected]>
Gerrit-Reviewer: Brion VIBBER <[email protected]>
Gerrit-Reviewer: Mhurd <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits