Page MenuHomePhabricator

API resolved redirects to special pages (wgDisableHardRedirects / wgInvalidRedirectTargets)
Closed, InvalidPublic

Description

Having a page with a redirect to a special page, than the GUI does not redirect automatically.

When using the api (titles=&redirects), the result show a redirect to the special page. I do not know, if this is intended. When yes, make this INVALID.

Thanks.


Version: unspecified
Severity: enhancement
URL: http://test.wikipedia.org/w/api.php?action=query&titles=Redirect%20to%20special%20page&redirects

Details

Reference
bz26865

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:19 PM
bzimport set Reference to bz26865.
bzimport added a subscriber: Unknown Object (MLST).

Sounds like API does not check the $wgDisableHardRedirects setting [0].

The possibility of resolving both normal redirects and redirects to the Special:-namespace is intended. However there is a setting (which is true on wikimedia wikis [1] ) to disable this. The API should check for that also.

I've tried to reproduce this but did not succeed [2] [3].

@Umherirrender: Could you link to an example where this is happening ?

Krinkle

[0] http://www.mediawiki.org/wiki/Manual:$wgDisableHardRedirects
[1] http://noc.wikimedia.org/conf/InitialiseSettings.php.txt (search for "wgDisableHardRedirects")

'wgDisableHardRedirects' => array(
'default' => true,

[2] http://www.mediawiki.org/wiki/User:Krinkle/Testcase/SpecialFilePath
[3] http://www.mediawiki.org/w/api.php?action=query&titles=User:Krinkle/Testcase/SpecialFilePath&redirects&indexpageids

(In reply to comment #1)

I've tried to reproduce this but did not succeed [2] [3].

I do not know, why Special:FilePath is not working ...

@Umherirrender: Could you link to an example where this is happening ?

I added a url with a testcase.

Thanks, it apparently acts different for Special:FilePath.

Reproduced error in both 1.16 and 1.18-svn [0]

[0]: http://translatewiki.net/w/api.php?action=query&titles=User:Krinkle/RedirectToSpecial&redirects

(In reply to comment #3)

Thanks, it apparently acts different for Special:FilePath.

See $wgInvalidRedirectTargets in DefaultSettings.php

(In reply to comment #0)

Having a page with a redirect to a special page, than the GUI does not redirect
automatically.

When using the api (titles=&redirects), the result show a redirect to the
special page. I do not know, if this is intended. When yes, make this INVALID.

Thanks.

The GUI does redirect.. If I visit a page with a redirect to a special page, I'm taken to that page automatically...

(In reply to comment #5)

(In reply to comment #0)

Having a page with a redirect to a special page, than the GUI does not redirect
automatically.

When using the api (titles=&redirects), the result show a redirect to the
special page. I do not know, if this is intended. When yes, make this INVALID.

Thanks.

The GUI does redirect.. If I visit a page with a redirect to a special page,
I'm taken to that page automatically...

Have you set wgDisableHardRedirects to true? It is false by default.

The api will not redirect by itself and does not provide a url for redirecting, so the wgDisableHardRedirects setting must not be respected. The redirects are also stored inside the redirects table, so that are redirects.

wgInvalidRedirectTargets is respected, because those redirects are not in the redirect table (and will not be added by the api)

It is always safer to let index.php doing redirects instead of calling the api to get the right 'to' page and call than index.php with the new page.