Page MenuHomePhabricator

Logo broken since MW 1.28 if $wgLogo starts with "//domain.com/"
Closed, ResolvedPublic

Description

Getting a strange error where logo disappeared when

$wgLogo	= "//static.mengniang.org/logo/MoegirlLibrary2015.png";

the url loaded in css is:

.mw-wiki-logo {
    background-image: url(/static.mengniang.org/logo/MoegirlLibrary2015.png?);
}

By adding https header it work again

$wgLogo	= "https://static.mengniang.org/logo/MoegirlLibrary2015.png";

Now it load correct logo image url:

.mw-wiki-logo {
    background-image: url(https://static.mengniang.org/logo/MoegirlLibrary2015.png);
}

https://library.moegirl.org/Mainpage

Event Timeline

Zoglun renamed this task from logo disappear when $wgLogo set to = "//domian.com/....." to logo disappear when $wgLogo set to = "//domian.com/....." in MW 1.28.Jan 14 2017, 5:19 PM
Zoglun triaged this task as Lowest priority.
Zoglun added a project: MW-1.28-release.

Change 332728 had a related patch set uploaded (by Krinkle):
tests: Add unit tests for OutputPage::transformResourcePath

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

Change 332730 had a related patch set uploaded (by Krinkle):
OutputPage: Ignore protocol-relative urls in transformResourcePath()

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

Change 332732 had a related patch set uploaded (by Krinkle):
Failing test case for I9b063f1219d

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

Krinkle renamed this task from logo disappear when $wgLogo set to = "//domian.com/....." in MW 1.28 to Logo broken since MW 1.28 if $wgLogo starts with "//domain.com/" .Jan 18 2017, 6:17 AM
Krinkle claimed this task.
Krinkle moved this task from Inbox to Assigned on the MediaWiki-ResourceLoader board.

Per https://gerrit.wikimedia.org/r/332730, a url is not supposed to make it into transformResourcePath(), but since MediaWiki 1.28 and use of ResourceLoaderSkinModule, this can happen via $wgLogo. The wikimedia/relpath library then wrongly interprets protocol-relative urls as urls relative to the document root (/) with an extraneous slash (//). This makes sense from the perspective of dealing only with file paths. But considering its primary use case is dealing with urls, we should probably add support for this in relpath as well. The input for relpath is typically part of a url, and part of a file system path; output is typically appended to a url prefix.

Change 332728 merged by jenkins-bot:
tests: Add unit tests for OutputPage::transformResourcePath

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

Change 332730 merged by jenkins-bot:
OutputPage: Ignore protocol-relative urls in transformResourcePath()

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

Change 332732 abandoned by Krinkle:
Failing test case for I9b063f1219d

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