aboutsummaryrefslogtreecommitdiff
path: root/mediawiki.lrdevplugin
diff options
context:
space:
mode:
authorRobin Krahl <github@ireas.org>2016-01-11 17:44:40 +0100
committerRobin Krahl <github@ireas.org>2016-01-11 17:44:40 +0100
commit3e918beb1556f09c8378298a83f49765d40d3265 (patch)
treef476f72ae10cdda255989eba376a9484ed895876 /mediawiki.lrdevplugin
parent80bdc7d930e13f387fd78f38bb424b9b04267473 (diff)
downloadLrMediaWiki-3e918beb1556f09c8378298a83f49765d40d3265.tar.gz
LrMediaWiki-3e918beb1556f09c8378298a83f49765d40d3265.tar.bz2
MediaWikiApi: Fix wrong indexing
If the result of `pairs` is assigned to only one variable, the variable will contain only the first value of the pair, not a list of both values. Fix #49.
Diffstat (limited to 'mediawiki.lrdevplugin')
-rwxr-xr-xmediawiki.lrdevplugin/MediaWikiApi.lua5
1 files changed, 3 insertions, 2 deletions
diff --git a/mediawiki.lrdevplugin/MediaWikiApi.lua b/mediawiki.lrdevplugin/MediaWikiApi.lua
index 3b1723d..96c3de0 100755
--- a/mediawiki.lrdevplugin/MediaWikiApi.lua
+++ b/mediawiki.lrdevplugin/MediaWikiApi.lua
@@ -247,11 +247,12 @@ function MediaWikiApi.upload(fileName, sourceFilePath, text, comment, ignoreWarn
return true
elseif uploadResult == 'Warning' then
local warnings = ''
- for pair in pairs(resultXml.upload.warnings) do
+ -- concatenate the keys of the warnings table (= MediaWiki name of the warning)
+ for warning in pairs(resultXml.upload.warnings) do
if warnings ~= '' then
warnings = warnings .. ', '
end
- warnings = warnings .. pair[0]
+ warnings = warnings .. warning
end
return warnings
else