diff --git a/WikiClientLibrary/Pages/Page.cs b/WikiClientLibrary/Pages/Page.cs
index f358fddbc..df7e3018c 100644
--- a/WikiClientLibrary/Pages/Page.cs
+++ b/WikiClientLibrary/Pages/Page.cs
@@ -32,7 +32,9 @@ public Page(Site site, string title, int defaultNamespaceId)
Site = site;
WikiClient = Site.WikiClient;
Debug.Assert(WikiClient != null);
- Title = WikiLink.NormalizeWikiLink(site, title, defaultNamespaceId);
+ var parsedTitle = WikiLink.Parse(site, title, defaultNamespaceId);
+ Title = parsedTitle.FullTitle;
+ NamespaceId = parsedTitle.Namespace.Id;
}
internal Page(Site site)
@@ -99,6 +101,11 @@ internal Page(Site site)
///
public bool Exists { get; private set; }
+ ///
+ /// Gets whether the page is a Special page.
+ ///
+ public bool IsSpecialPage { get; private set; }
+
///
/// Content model. (MediaWiki 1.22)
///
@@ -262,8 +269,9 @@ protected virtual void OnLoadPageInfo(JObject jpage)
Exists = jpage["missing"] == null;
ContentModel = (string) jpage["contentmodel"];
PageLanguage = (string) jpage["pagelanguage"];
+ IsSpecialPage = jpage["special"] != null;
IsRedirect = jpage["redirect"] != null;
- if (Exists)
+ if (Exists && !IsSpecialPage)
{
ContentLength = (int) jpage["length"];
LastRevisionId = (int) jpage["lastrevid"];
@@ -440,6 +448,9 @@ public IAsyncEnumerable EnumTransclusionsAsync(IEnumerable namespac
/// You should call again
/// if you're interested in them.
///
+ /// Cannot create actual page in the specified namespace.
+ /// Edit conflict detected.
+ /// You have no rights to edit the page.
public Task UpdateContentAsync(string summary)
{
return UpdateContentAsync(summary, false, true, AutoWatchBehavior.Default, CancellationToken.None);
@@ -455,6 +466,9 @@ public Task UpdateContentAsync(string summary)
/// , , and .
/// You should call again if you're interested in them.
///
+ /// Cannot create actual page in the specified namespace.
+ /// Edit conflict detected.
+ /// You have no rights to edit the page.
public Task UpdateContentAsync(string summary, bool minor)
{
return UpdateContentAsync(summary, minor, true, AutoWatchBehavior.Default, CancellationToken.None);
@@ -470,6 +484,9 @@ public Task UpdateContentAsync(string summary, bool minor)
/// , , and .
/// You should call again if you're interested in them.
///
+ /// Cannot create actual page in the specified namespace.
+ /// Edit conflict detected.
+ /// You have no rights to edit the page.
public Task UpdateContentAsync(string summary, bool minor, bool bot)
{
return UpdateContentAsync(summary, minor, bot, AutoWatchBehavior.Default, CancellationToken.None);
@@ -487,6 +504,7 @@ public Task UpdateContentAsync(string summary, bool minor, bool bot)
/// You should call again
/// if you're interested in them.
///
+ /// Cannot create actual page in the specified namespace.
/// Edit conflict detected.
/// You have no rights to edit the page.
public Task UpdateContentAsync(string summary, bool minor, bool bot, AutoWatchBehavior watch)
@@ -506,6 +524,7 @@ public Task UpdateContentAsync(string summary, bool minor, bool bot, AutoW
/// You should call again
/// if you're interested in them.
///
+ /// Cannot create actual page in the specified namespace.
/// Edit conflict detected.
/// You have no rights to edit the page.
public async Task UpdateContentAsync(string summary, bool minor, bool bot, AutoWatchBehavior watch,
@@ -541,6 +560,8 @@ public async Task UpdateContentAsync(string summary, bool minor, bool bot,
{
case "protectedpage":
throw new UnauthorizedOperationException(ex);
+ case "pagecannotexist":
+ throw new InvalidOperationException(ex.ErrorMessage, ex);
default:
throw;
}