Page MenuHomePhabricator

PageLoader.js hardcodes wikipedia.org
Closed, ResolvedPublic

Description

I recently (today) setup ContentTranslation and (in order to work with the extension properly) restbase and also the cxserver part. However, I took me some time to find out, why the cxserver keeps saying, that the content source page could not be loaded on one of the wikis in the farm. The problem I found way, that the cxserver, if a language code is passed to it's REST api endpoint (e.g. /v1/page/en/Pagetitle) assumes, that the client requested the data for a wikipedia.org page, see https://github.com/wikimedia/mediawiki-services-cxserver/blob/02437af6931e45facee5b4ba2a264676fbc81d99/lib/pageloader/PageLoader.js#L46

	if ( /.+\.org$/.test( source ) ) {
		// We got an actual domain
		domain = source;
	} else {
		// Assume the client means a WP project
		domain = source + '.wikipedia.org';
	}

This, however, is barely correct for installations outside of the Wikipedia/Wikimedia world. I'm not sure, if this is really a bug, which should be fixed (maybe make this configurable, or remove the condition here completely, which would, iirc, requires the client to pass an actual domain, which also needs to end with .org, which is also not always true) or if I missed one configuration step, which totally possible.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Indeed this should not be hardcoded. Just that we did not give any attention to make cxserver work with arbitrary non-wikipedia wikis. I plan to make this at least configuration driven.

Change 374493 had a related patch set uploaded (by Santhosh; owner: Santhosh):
[mediawiki/services/cxserver@master] Avoid hardcoding wikipedia.org domain for APIs

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

Arrbee triaged this task as Medium priority.Sep 26 2017, 7:16 AM

Change 374493 merged by jenkins-bot:
[mediawiki/services/cxserver@master] Avoid hardcoding wikipedia.org domain for APIs

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