Page MenuHomePhabricator

Fix the `url=` preset parameter to the UrlShortener at https://w.wiki
Open, Needs TriagePublic

Description

There is (currently unused code) in the extension that demonstrates how it would work:

		$localURL = SpecialPage::getTitleFor( 'UrlShortener' )->getLocalURL( [ 'url' => $fullURL ] );

It appears to not be working anymore:

Note that this will not produce a url directly, it merely presets the form so that users don't have to copy things from the addressbar manually. This would be a nice way for gadgets and local communities to expose the new shortener e.g. from a sidebar link. I assume that's why it was added :) but it looks like it may've broke in in a refactor during the past year.

Event Timeline

Krinkle created this task.Jul 2 2020, 5:15 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJul 2 2020, 5:15 PM

Change 609216 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[mediawiki/extensions/UrlShortener@master] Make Special:UrlShortener read default URL from URL

https://gerrit.wikimedia.org/r/c/mediawiki/extensions/UrlShortener/ /609216

The first one does not work., but the second does. Clicking https://meta.wikimedia.org/wiki/Special:UrlShortener?url=https://wikimedia.org/ shows the form populated with the url.

The first one does not work., but the second does. Clicking https://meta.wikimedia.org/wiki/Special:UrlShortener?url=https://wikimedia.org/ shows the form populated with the url.

Huh, interesting! I tried that several times and could not get it work. I see it working now though... Yay!

There is (currently unused code) in the extension that demonstrates how it would work:
$localURL = SpecialPage::getTitleFor( 'UrlShortener' )->getLocalURL( [ 'url' => $fullURL ] );

This code is still used in the extension. Its use will only be seen on wikis where the extension sidebar link is not disabled though. It creates the sidebar link that allows direct generation without going to the Special page. (The extension loads a js module that does that via the API). This is disabled on WMF wikis but it's enabled by default in the extension.

Ammarpad claimed this task.Jul 3 2020, 5:39 AM

It's a bit tricky what's happening here, but I believe I understand it.

Change 614748 had a related patch set uploaded (by Ammarpad; owner: Ammarpad):
[mediawiki/extensions/UrlShortener@master] UrlShortener: Remove config renaming hack

https://gerrit.wikimedia.org/r/614748

Change 614748 had a related patch set uploaded (by Ammarpad; owner: Ammarpad):
[mediawiki/extensions/UrlShortener@master] UrlShortener: Remove config renaming hack

https://gerrit.wikimedia.org/r/614748

Wrong task number.

Ammarpad removed Ammarpad as the assignee of this task.Mon, Jul 20, 1:43 PM