From 3e918beb1556f09c8378298a83f49765d40d3265 Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Mon, 11 Jan 2016 17:44:40 +0100 Subject: 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. --- mediawiki.lrdevplugin/MediaWikiApi.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'mediawiki.lrdevplugin') 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 -- cgit v1.2.3