diff --git a/CHANGELOG.md b/CHANGELOG.md index de004945195..45eec79f88c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -80,6 +80,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv - Fixed an issue on Windows where the browser extension reported failure to send an entry to JabRef even though it was sent properly. [JabRef-Browser-Extension#493](https://github.com/JabRef/JabRef-Browser-Extension/issues/493) - Fixed an issue on Windows where TeXworks path was not resolved if it was installed with MiKTeX. [#10977](https://github.com/JabRef/jabref/issues/10977) - We fixed an issue with where JabRef would throw an error when using MathSciNet search, as it was unable to parse the fetched JSON coreectly. [10996](https://github.com/JabRef/jabref/issues/10996) +- We fixed an issue where the "Import by ID" function would throw an error when a DOI that contains URL-encoded characters was entered. [#10648](https://github.com/JabRef/jabref/issues/10648) ### Removed diff --git a/src/main/java/org/jabref/model/entry/identifier/DOI.java b/src/main/java/org/jabref/model/entry/identifier/DOI.java index 1212b658606..0cead0708a7 100644 --- a/src/main/java/org/jabref/model/entry/identifier/DOI.java +++ b/src/main/java/org/jabref/model/entry/identifier/DOI.java @@ -47,7 +47,7 @@ public class DOI implements Identifier { + "10" // directory indicator + "(?:\\.[0-9]+)+" // registrant codes + "[/:]" // divider - + "(?:[^\\s,;]+[^,;(\\.\\s)])" // suffix alphanumeric without " "/","/";" and not ending on "."/","/";" + + "(?:[^\\s,]+[^,;(\\.\\s)])" // suffix alphanumeric without " "/"," and not ending on "."/","/";" + ")"; // end group \1 // Regex (Short DOI) diff --git a/src/test/java/org/jabref/model/entry/identifier/DOITest.java b/src/test/java/org/jabref/model/entry/identifier/DOITest.java index 685dfb7d712..f7439f9cdb4 100644 --- a/src/test/java/org/jabref/model/entry/identifier/DOITest.java +++ b/src/test/java/org/jabref/model/entry/identifier/DOITest.java @@ -200,7 +200,7 @@ private static Stream testData() { Arguments.of("10.1007/s10549-018-4743-9", DOI.findInText("Breast Cancer Res Treat. 2018 July ; 170(1): 77–87. doi:10.1007/s10549-018-4743-9, ").get().getDOI()), Arguments.of("10.1007/s10549-018-4743-9", - DOI.findInText("Breast Cancer Res Treat. 2018 July ; 170(1): 77–87. doi:10.1007/s10549-018-4743-9;something else").get().getDOI()), + DOI.findInText("Breast Cancer Res Treat. 2018 July ; 170(1): 77–87. doi:10.1007/s10549-018-4743-9; something else").get().getDOI()), Arguments.of("10.1007/s10549-018-4743-9.1234", DOI.findInText("bla doi:10.1007/s10549-018-4743-9.1234 with . in doi").get().getDOI()), @@ -316,4 +316,10 @@ public void rejectMissingDividerInShortDoi() { public void rejectNullDoiParameter() { assertThrows(NullPointerException.class, () -> new DOI(null)); } + + @Test + public void findDoiWithSpecialCharactersInText() { + assertEquals(Optional.of(new DOI("10.1175/1520-0493(2002)130%3C1913:EDAWPO%3E2.0.CO;2")), + DOI.findInText("https://doi.org/10.1175/1520-0493(2002)130%3C1913:EDAWPO%3E2.0.CO;2")); + } }