jenkins-bot submitted this change.

View Change


Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
[fix] file title must have a valid file extension

An invalid file extension will lead to a ValueError.
Skip the current file or retry to enter a valid filename.

Bug: T345786
Change-Id: Ie95c837156d893e2e8faa6eaac96fc95a63531a8
---
M pywikibot/specialbots/_upload.py
1 file changed, 20 insertions(+), 7 deletions(-)

diff --git a/pywikibot/specialbots/_upload.py b/pywikibot/specialbots/_upload.py
index ce8bd29..0aad35d 100644
--- a/pywikibot/specialbots/_upload.py
+++ b/pywikibot/specialbots/_upload.py
@@ -3,7 +3,7 @@
Do not import classes directly from here but from specialbots.
"""
#
-# (C) Pywikibot team, 2003-2023
+# (C) Pywikibot team, 2003-2024
#
# Distributed under the terms of the MIT license.
#
@@ -270,13 +270,13 @@
if self.opt.always:
pywikibot.info('File format is not one of [{}]'
.format(' '.join(allowed_formats)))
- continue

- if not pywikibot.input_yn(
- 'File format is not one of [{}], but {!r}. Continue?'
- .format(' '.join(allowed_formats), ext),
- default=False):
- continue
+ elif pywikibot.input_yn(
+ 'File format is not one of [{}], but {!r}. Skip?'
+ .format(' '.join(allowed_formats), ext)):
+ return None
+
+ continue

potential_file_page = pywikibot.FilePage(self.target_site,
filename)

To view, visit change 1015994. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ie95c837156d893e2e8faa6eaac96fc95a63531a8
Gerrit-Change-Number: 1015994
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged