From e64cb6d3f02aa1f343cfad321718337936b1c61b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=ED=98=84=EC=9A=B0?= Date: Fri, 4 Oct 2024 14:02:29 +0900 Subject: [PATCH] Allow addon page URL on AddonsDialog (#3467) * Allow users to just copy&paste addon page URL to addon 'code' field. https://forums.ankiweb.net/t/get-addons-allow-url-on-code-section/36370 --- CONTRIBUTORS | 1 + qt/aqt/addons.py | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 748b753ad..f2a931c89 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -195,6 +195,7 @@ Taylor Obyen <162023405+taylorobyen@users.noreply.github.com> Kris Cherven twwn Shirish Pokhrel +Park Hyunwoo ******************** diff --git a/qt/aqt/addons.py b/qt/aqt/addons.py index b4f3868e7..d5fa3d873 100644 --- a/qt/aqt/addons.py +++ b/qt/aqt/addons.py @@ -1066,7 +1066,12 @@ class GetAddons(QDialog): def accept(self) -> None: # get codes try: - ids = [int(n) for n in self.form.code.text().split()] + sids = self.form.code.text().split() + sids = [ + re.sub(r"^https://ankiweb.net/shared/info/(\d+)$", r"\1", id_) + for id_ in sids + ] + ids = [int(id_) for id_ in sids] except ValueError: showWarning(tr.addons_invalid_code()) return