Last modified: 2011-04-14 15:11:29 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T17512, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 15512 - action=render fails to expand style image URLs
action=render fails to expand style image URLs
Status: NEW
Product: MediaWiki
Classification: Unclassified
Parser (Other open bugs)
1.14.x
All All
: Low normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks: 9355
  Show dependency treegraph
 
Reported: 2008-09-07 18:26 UTC by Juliano F. Ravasi
Modified: 2011-04-14 15:11 UTC (History)
0 users

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Juliano F. Ravasi 2008-09-07 18:26:20 UTC
When viewing pages with action=render, style and image URLs are not properly expanded (i.e., transformed from "$wgStylePath/..." to "$wgServer$wgStylePath/...".

Some affected places:
* Article::viewRedirect()
* EnhancedChangesList::arrow()
* Linker::makeThumbLink2()
* TablePager::getStartBody()
* TablePager::getNavigationBar()

I suppressed from this list uses of $wgStylePath that shouldn't happen during action=render (i.e. skin displaying).

The easiest solution seems to be to rewrite $wgStylePath during startup, like this:

  global $wgStylePath, $wgRequest;

  if ( $wgRequest->getVal( 'action' ) == 'render' ) {
    $wgStylePath = wfExpandUrl( $wgStylePath );
  }

It seems to work fine, as far as I tested (I'm casting this from inside an extension). It is as ugly as the  workaround currently (as of 1.14-svn) found in Title::getLocalUrl() for the same purpose, but it works.

Some better solution is demanded, sniffing into request vars is ugly at best.
Comment 1 Juliano F. Ravasi 2008-09-08 15:51:29 UTC
Update: I'm currently using this "fix":

	# Work around bug in MediaWiki 1.13 when '?action=render'.
	# https://bugzilla.wikimedia.org/show_bug.cgi?id=15512
	global $wgRequest, $wgScriptPath, $wgUploadPath;
	global $wgStylePath, $wgMathPath, $wgLocalFileRepo;
	if ( $wgRequest->getVal( 'action' ) == 'render' ) {
		$wgScriptPath = wfExpandUrl( $wgScriptPath );
		$wgUploadPath = wfExpandUrl( $wgUploadPath );
		$wgStylePath  = wfExpandUrl( $wgStylePath  );
		$wgMathPath   = wfExpandUrl( $wgMathPath   );
		$wgLocalFileRepo['url'] = wfExpandUrl( $wgLocalFileRepo['url'] );
	}

It also "fixes" bug 9355.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links