From 6e13089def4c605fe52d49fb5e2c8cbe0ef924f6 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 6 Dec 2024 16:20:12 +0530 Subject: [PATCH] Fix #2091152 [Enhancement Request: Resolve doi.org links when pasting identifiers](https://bugs.launchpad.net/calibre/+bug/2091152) --- src/calibre/gui2/metadata/basic_widgets.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/calibre/gui2/metadata/basic_widgets.py b/src/calibre/gui2/metadata/basic_widgets.py index 9037ea946f..b57a06f978 100644 --- a/src/calibre/gui2/metadata/basic_widgets.py +++ b/src/calibre/gui2/metadata/basic_widgets.py @@ -1808,6 +1808,18 @@ class IdentifiersEdit(QLineEdit, ToMetadataMixin, LineEditIndicators): return True except Exception: pass + for (key, prefix) in ( + ('doi', 'https://dx.doi.org/'), + ('doi', 'https://doi.org/'), + ('arxiv', 'https://arxiv.org/abs/'), + ('oclc', 'https://www.worldcat.org/oclc/'), + ('issn', 'https://www.worldcat.org/issn/'), + ): + if text.startswith(prefix): + vals = self.current_val + vals[key] = text[len(prefix):].strip() + self.current_val = vals + return True return False # }}}