diff --git a/UnitTestProject1/Tests/SiteTests.cs b/UnitTestProject1/Tests/SiteTests.cs index b20adbc69..3ee4a4f6c 100644 --- a/UnitTestProject1/Tests/SiteTests.cs +++ b/UnitTestProject1/Tests/SiteTests.cs @@ -49,6 +49,7 @@ public async Task TestWpTest2() Assert.Equal("Wikipedia", site.SiteInfo.SiteName); Assert.Equal("Main Page", site.SiteInfo.MainPage); Assert.Equal("https://test2.wikipedia.org/wiki/test%20page", site.SiteInfo.MakeArticleUrl("test page")); + Assert.Equal("https://test2.wikipedia.org/wiki/test%20page%20(DAB)", site.SiteInfo.MakeArticleUrl("test page (DAB)")); var messages = await site.GetMessagesAsync(new[] {"august"}); Assert.Equal("August", messages["august"]); ValidateNamespaces(site); diff --git a/WikiClientLibrary/Sites/SiteInfo.cs b/WikiClientLibrary/Sites/SiteInfo.cs index 6990c8bfe..1a0bdc8b8 100644 --- a/WikiClientLibrary/Sites/SiteInfo.cs +++ b/WikiClientLibrary/Sites/SiteInfo.cs @@ -75,7 +75,11 @@ public class SiteInfo /// /// The title of the article. /// is null. - /// This overload uses https: as default protocol for protocol-relative. + /// + /// This overload uses https: as default protocol for protocol-relative URL. + /// For wiki sites with specified-protocol , such as Wikia (which uses http), + /// this overload respects the server-chosen protocol. + /// public string MakeArticleUrl(string title) { return MakeArticleUrl(title, "https"); @@ -85,10 +89,15 @@ public string MakeArticleUrl(string title) /// Makes the full URL to the page of specified title. /// /// The title of the article. - /// For protocol-relative URL (e.g. //en.wikipedia.org/), + /// + /// For wiki sites whose is protocol-relative URL (e.g. //en.wikipedia.org/), /// specifies the default protocol to use. (e.g. https) /// Either or is null. /// The full URL of the article. + /// + /// For wiki sites with specified-protocol , such as Wikia (which uses http), + /// this overload respects the server-chosen protocol. + /// public string MakeArticleUrl(string title, string defaultProtocol) { if (title == null) throw new ArgumentNullException(nameof(title)); diff --git a/WikiClientLibrary/WikiClientLibrary.csproj b/WikiClientLibrary/WikiClientLibrary.csproj index 217a5a40e..38966d9e1 100644 --- a/WikiClientLibrary/WikiClientLibrary.csproj +++ b/WikiClientLibrary/WikiClientLibrary.csproj @@ -4,9 +4,9 @@ netstandard1.1;netstandard2.0 WikiClientLibrary CXuesong.MW.WikiClientLibrary - 0.6.3 - 0.6.3.0 - 0.6.3.0 + 0.6.4 + 0.6.4.0 + 0.6.4.0 Copyright (C) CXuesong 2018 Wiki Client Library is a .NET Standard & asynchronous client library for MediaWiki sites.