mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-24 14:33:59 +00:00
MWMediaResourceProvider: Use exist instead of bool check on API values
In the MediaWiki API, booleans exist or don't exist (with an empty string), you can't check "if (bool)..." since that will always be false. The API has a newer formatversion=2 that fixes this but we're not using that yet. Also update the defaultSource placeholder to match the API response. If one would only update defaultSource without the 'if'-fix, one can reproduce T66822 on a local wiki (JSON-P request instead of JSON). Bug: T66822 Change-Id: I5a8ab1136325c33c62982c0869fa14ca2fb26034
This commit is contained in:
parent
85b86fb45d
commit
7d5e5ec9a9
|
@ -24,9 +24,9 @@ ve.dm.MWMediaResourceProvider = function VeDmMWMediaResourceProvider( apiurl, co
|
|||
|
||||
// Fetching configuration
|
||||
this.scriptDirUrl = config.scriptDirUrl;
|
||||
this.isLocal = config.local;
|
||||
this.isLocal = ( 'local' in config );
|
||||
|
||||
if ( config.local ) {
|
||||
if ( this.isLocal ) {
|
||||
this.setAjaxSettings( {
|
||||
url: mw.util.wikiScript( 'api' ),
|
||||
// If the url is local use json
|
||||
|
|
|
@ -75,7 +75,7 @@ ve.dm.MWMediaResourceQueue.prototype.setup = function () {
|
|||
ve.dm.MWMediaResourceQueue.prototype.getFileRepos = function () {
|
||||
var defaultSource = [ {
|
||||
url: mw.util.wikiScript( 'api' ),
|
||||
local: true
|
||||
local: ''
|
||||
} ];
|
||||
|
||||
if ( !this.fileRepoPromise ) {
|
||||
|
|
Loading…
Reference in a new issue