Page MenuHomePhabricator

Wikidata Query Service UI should show alt code from WMF URL shortener
Open, Needs TriagePublicBUG REPORT

Description

Wikidata Query UI calls WMF shortenurl API to make short url. While the API returns two different codes always, the UI only shows one.

It should show both.

Original task desctiption:
It appears that T221016 has regressed. @Stuartyeates just minted the following URL
https://w.wiki/G3E$
This url is problematic because many systems don't recognize $ being part of a url when making plaintext linked. This was previously fixed where such a problematic character was automatically mapped to -, but this no longer seems to be in effect ?

Event Timeline

You can use the alt code: https://w.wiki/_mzo2

There's no regression here. The resolution of T221016 was to support aliasing, not remove $ from the id set. (Which was deemed technically infeasible)

Since $ is still in the id set, shortcodes that may contain it will continue to be generated. You should use the provided alt code, when you want use it on platforms where the $ char causes linking issue.

Why are we giving endusers a non-alt code in that case? This shouldn’t be up to a user to have to figure out. User press button, user get link, link always work, is the only valid path here I think…

OK, if you shorten url on wiki, both codes will be shown.

The above code seems to be generated at https://query.wikidata.org. WQS uses the shortenurl API but it seems it only shows the canonical code as its result. The alt is discarded. The API itself always returns both codes.

The answer looks to be:

			if ( data && !data.error && data.shortenurl && data.shortenurl.shorturlalt ) {
				text = data.shortenurl.shorturlalt;
			} else if ( data && !data.error && data.shortenurl && data.shortenurl.shorturl ) {
				text = data.shortenurl.shorturl;
			} else {
				text = wikibase.queryService.ui.i18n.getMessage( 'wdqs-app-urlshortener-failed' );
			}
Ammarpad renamed this task from Special Characters (like $ at the end) are used in short URL to Wikidata Query Service UI should show alt code from WMF URL shorterner.Nov 12 2025, 8:31 AM
Ammarpad renamed this task from Wikidata Query Service UI should show alt code from WMF URL shorterner to Wikidata Query Service UI should show alt code from WMF URL shortener.
Ammarpad updated the task description. (Show Details)
Aklapper lowered the priority of this task from Unbreak Now! to Needs Triage.Apr 25 2026, 3:06 PM