CXuesong / WikiClientLibrary

/*🌻*/ Wiki Client Library is an asynchronous MediaWiki API client library targeting modern .NET platforms
https://github.com/CXuesong/WikiClientLibrary/wiki
Apache License 2.0
80 stars 16 forks source link

Wikidata saving stopped working as revids overflow int32 now #112

Closed mormegil-cz closed 3 months ago

mormegil-cz commented 3 months ago

Wikidata recorded its 2³²th edit on 2024-05-07; since then, WikiClientLibrary throws an exception on every edit, since Entity.LastRevisionId is only int:

System.OverflowException: Value was either too large or too small for an Int32.
   at System.Convert.ThrowInt32OverflowException()
   at System.Convert.ToInt32(Int64 value)
   at Newtonsoft.Json.Linq.JToken.op_Explicit(JToken value)
   at WikiClientLibrary.Wikibase.Entity.ProgressiveEditAsync(IEnumerable`1 edits, String summary, Boolean isBot, Boolean strict, CancellationToken cancellationToken)
   at WikiClientLibrary.Wikibase.Entity.EditAsync(IEnumerable`1 edits, String summary, EntityEditOptions options, CancellationToken cancellationToken)

Entity.LastRevisionId (and possibly other similar variables?) needs to be long (and the explicit casts from JToken to int assigning to it in Entity.ProgressiveEditAsync need to be adjusted as well).

mormegil-cz commented 3 months ago

Oh, now I see LastRevisionId has already been changed in df21c73a5636676cff99eeb2a1c7a1e2218f88bf; however, the casts have not been updated with it. Making a PR.