diff options
author | Robin Krahl <github@ireas.org> | 2016-01-11 17:44:40 +0100 |
---|---|---|
committer | Robin Krahl <github@ireas.org> | 2016-01-11 17:44:40 +0100 |
commit | 3e918beb1556f09c8378298a83f49765d40d3265 (patch) | |
tree | f476f72ae10cdda255989eba376a9484ed895876 | |
parent | 80bdc7d930e13f387fd78f38bb424b9b04267473 (diff) | |
download | LrMediaWiki-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.
-rwxr-xr-x | mediawiki.lrdevplugin/MediaWikiApi.lua | 5 |
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 |