jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/860501 )
Change subject: Retrieve only one match ......................................................................
Retrieve only one match
Change-Id: I2e35bcc2e690d3fc0640dcf5e37928ef9d26087a --- M scripts/checkimages.py 1 file changed, 12 insertions(+), 3 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/scripts/checkimages.py b/scripts/checkimages.py index 5eb5923..ae6d170 100755 --- a/scripts/checkimages.py +++ b/scripts/checkimages.py @@ -610,10 +610,10 @@ def upload_bot_change_function(report_page_text, upload_bot_array) -> str: """Detect the user that has uploaded the file through upload bot.""" regex = upload_bot_array[1] - results = re.findall(regex, report_page_text) + result = re.search(regex, report_page_text)
- if results: - return results[0] + if result: + return result.group()
# we can't find the user, report the problem to the bot return upload_bot_array[0]
pywikibot-commits@lists.wikimedia.org