You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a simple article that redirects to a missing article. When creating the page instance and immediately calling getRedirectTarget or isRedirect the call throws a MwnErrorMissingPage error because the api (obviously) returns that the target doesn't exist. However when first calling text on the page instance, getRedirectTarget uses the text of the article to determine the (intended) redirect target and correctly returns it. Imho the (externally observed) behaviour shouldn't change based on other calls I might've done before, ideally returning the target either way.
While checking the function I've seen that there's also a regex in place, however that didn't work at all for me and it also doesn't consider localizations (eg in a german wiki #weiterleitung and #redirect are valid).
The text was updated successfully, but these errors were encountered:
All valid points. Unfortunately, the read operations in MwnPage are a mess. In addition, many of the methods in this class use action=parse which invokes the MediaWiki parser instead of reading pre-parsed data from the db. All of this needs to be resolved in a v3 release as they involve breaking changes. For now, I'd suggest using lower-level methods, bot.read() or bot.query(), to get the data directly.
Obviously currently only handles english and german, which would need to be adjusted, but maybe this would be an idea? At least in the wiki the bot is currently running this catches all cases.
I have a simple article that redirects to a missing article. When creating the page instance and immediately calling
getRedirectTarget
orisRedirect
the call throws aMwnErrorMissingPage
error because the api (obviously) returns that the target doesn't exist. However when first callingtext
on the page instance,getRedirectTarget
uses the text of the article to determine the (intended) redirect target and correctly returns it. Imho the (externally observed) behaviour shouldn't change based on other calls I might've done before, ideally returning the target either way.While checking the function I've seen that there's also a regex in place, however that didn't work at all for me and it also doesn't consider localizations (eg in a german wiki
#weiterleitung
and#redirect
are valid).The text was updated successfully, but these errors were encountered: