Page MenuHomePhabricator

iw.toolforge.org does not support URL-encoded query parameters ([[toolforge:foo?bar]])
Open, Needs TriagePublicFeature

Description

Feature summary:
The iw tool should support being called with URL-encoded query parameters, i.e. /toolname/path%3Fp1%3Dv1%26p2%3Dv2 should be equivalent to /toolname/path?p1=v1&p2=v2.

Use case(s):
It currently supports forwarding regular query parameters (since T258444 was fixed), but it’s not clear to me when this feature is actually used (@Legoktm or @Nintendofan885 may be able to explain). If you put a link like [[toolforge:foo?bar]] into wikitext, it will generate a link with a URL-encoded ?, & and =. IMHO it would be more useful if it also supported URL-encoded query parameters.

This would make it possible to convert many Toolforge links from extlink syntax to wikilink syntax, which is better for the database (see also T343131), as well as being more convenient to write by hand (though admittedly it doesn’t beat just copy+pasting a URL into an extlink).

For example, the wikitext [[toolforge:scholia?qid=Q1513315]] currently links to https://iw.toolforge.org/scholia%3Fqid%3DQ1513315 (demo on user sandbox), which redirects to https://scholia?qid=Q1513315.toolforge.org/. It would be better if it redirected to https://scholia.toolforge.org/?qid=Q1513315 instead.

Benefits:
Shrink the Commons database significantly (T343131#9147662).

Potential issues:
This changes the interpretation of any existing [[toolforge:foo?bar]] links. My guess is that there are essentially no current links with URL-encoded query parameters that actually do what the author intended, but I might be missing something.

I have no idea whether this feature request is even possible to implement in a Kubernetes Ingress.

If this is implemented, pasting Toolforge URLs with query parameters into VisualEditor will probably still generate external link syntax instead of wikilink syntax, because (I assume – pure guess) VisualEditor will (correctly) know that wikilink syntax would URL-encode the query parameters, without knowing that the resulting URL is actually equivalent.

Event Timeline

It currently supports forwarding regular query parameters (since T258444 was fixed), but it’s not clear to me when this feature is actually used (@Legoktm or @Nintendofan885 may be able to explain). If you put a link like [[toolforge:foo?bar]] into wikitext, it will generate a link with a URL-encoded ?, & and =.

I now understand when this is used: there are many, many places on-wiki that generate external links to iw.toolforge.org, using something like [{{fullurl:toolforge:guc|user=Example}} global contribs]. (Truth be told, most of them use “toollabs” as the prefix rather than “toolforge”, but tomato tomato.) IMHO there are several better options for such links:

  • For very widely used tools, a dedicated interwiki prefix could be introduced to make internal links like e.g. [[globalcontribs:Example]] work. (Only works if there aren’t several variable query parameters.)
  • More generally, I still think it would be nice to have this task if possible, so that e.g. [[toolforge:guc?user=Example]] works.
  • But in the meantime, I think it’s better to link to the URL directly (e.g. [https://guc.toolforge.org/?user=Example global contribs]), and I’ve been submitting some edit requests and making some edits in that direction.

But this definitely means we need to continue forwarding regular query parameters. I hope that doesn’t rule out also supporting URL-encoded parameters (I’m not sure).

As far as I understand it, implementing this behavior would basically make iw.toolforge the only interwiki target capable of accepting query strings. By that I mean that the lack of syntax to generate normal query string clauses without URL encoding is a feature/bug of MediaWiki's internal link syntax. If we implement special support for working around this feature/bug specifically for Toolforge how would any normal wiki editor find that out?

The far easier solution would be to just have the tool in question not use a query string for parameters, aka [[toolforge:scholia/Q1513315]], which is, AFAICT, what was implemented? Visiting https://iw.toolforge.org/scholia/Q1513315 works for me.

I think it's reasonable to ask for support for e.g. https://guc.toolforge.org/user/Example too.

Switching to path-based input is something that tool developers would need to support in each tool

Switching to path-based input is something that tool developers would need to support in each tool

That seems unlikely in practice. Have you tried getting Magnus to update something with his tools...? ;-)