Page MenuHomePhabricator

action=render fails to expand style image URLs
Closed, ResolvedPublic

Description

Author: bugs

Description:
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.


Version: 1.14.x
Severity: normal

Details

Reference
bz15512

Related Objects

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 10:23 PM
bzimport added a project: MediaWiki-Parser.
bzimport set Reference to bz15512.
bzimport added a subscriber: Unknown Object (MLST).

bugs wrote:

Update: I'm currently using this "fix":

  1. Work around bug in MediaWiki 1.13 when '?action=render'.
  2. 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.

TheDJ closed this task as Resolved.EditedDec 21 2021, 9:45 PM
TheDJ claimed this task.
TheDJ subscribed.

Pretty sure this was fixed al long time ago or rather, it's not the job of render to expand the paths of images to full urls..