Last modified: 2012-01-30 22:15:41 UTC
ApiSandbox example links, introduced in r109226 (see also bug #32739), use a relative URL pointing just to “api.php?etc.” (exactly as received from the getExamples() method in the API module). But this does not work if the ApiSandbox special page runs at its canonical location of “.../wiki/Special:ApiSandbox” (examples link to “.../wiki/api.php?etc”, which is wrong), it works only when tested at the raw “.../w/index.php?title=Special:ApiSandbox” path.
Does this break anything? Cause these hrefs are usedonly to be parsed by JS, you should never be able to follow these links.
(In reply to comment #1) > Does this break anything? Cause these hrefs are usedonly to be parsed by JS, > you should never be able to follow these links. What do you mean “parsed by JS”? JS uses them to display a hypertext link, and this link (its href attribute) is wrong. Go to https://en.wikipedia.org/wiki/Special:ApiSandbox, select an action there (e.g. articlefeedback), click the Example button, a link with the text “api.php?action=articlefeedback” and pointing to https://en.wikipedia.org/wiki/api.php?action=articlefeedback appears above. And that destination URL is wrong.
(In reply to comment #2) > And that destination URL is wrong. Clicking on such links doesn't bring you to those links' destination.
(In reply to comment #3) > (In reply to comment #2) > > And that destination URL is wrong. > > Clicking on such links doesn't bring you to those links' destination. OK, I don’t get it. When I was testing the API using the sandbox, I middle-clicked the example, which opened another tab with “Wikipedia does not recognize the action specified by the URL.” And I saw the href on the anchor does indeed contain the invalid URL. Now, after you pointed that out, I tried left-clicking the link to learn that, indeed, it does nothing (I guess a dummy onclick handler?). But… What is the point, then? If you want to just display an example URL (with no intention to make it work), then do not wrap it into an <a> tag. If you wrap it, use an href making sense. Or, what purpose does that anchor serve?
Took me a bit to understand the request, but I agree, the hyperlinked URLs should point to the /w/api.php URL
r110333.