diff --git a/CHANGELOG.md b/CHANGELOG.md index 63a55f4ba26..168a1f1f32b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -80,6 +80,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve - We fixed an issue with opacity of disabled icon-buttons [#7195](https://github.com/JabRef/jabref/issues/7195) - We fixed an issue where journal abbreviations in UTF-8 were not recognized [#5850](https://github.com/JabRef/jabref/issues/5850) - We fixed an issue where the article title with curly brackets fails to download the arXiv link (pdf file). [#7633](https://github.com/JabRef/jabref/issues/7633) +- We fixed an issue where the article title with colon fails to download the arXiv link (pdf file). [#7660](https://github.com/JabRef/issues/7660) ### Removed diff --git a/src/main/java/org/jabref/logic/importer/fetcher/ArXiv.java b/src/main/java/org/jabref/logic/importer/fetcher/ArXiv.java index c63395708a0..0ee11216d1c 100644 --- a/src/main/java/org/jabref/logic/importer/fetcher/ArXiv.java +++ b/src/main/java/org/jabref/logic/importer/fetcher/ArXiv.java @@ -16,6 +16,8 @@ import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; +import org.jabref.logic.cleanup.CleanupJob; +import org.jabref.logic.cleanup.EprintCleanup; import org.jabref.logic.help.HelpFile; import org.jabref.logic.importer.FetcherException; import org.jabref.logic.importer.FulltextFetcher; @@ -116,6 +118,9 @@ private Optional searchForEntryById(String id) throws FetcherExcepti } private List searchForEntries(BibEntry entry) throws FetcherException { + entry = (BibEntry) entry.clone(); + CleanupJob cleanupJob = new EprintCleanup(); + cleanupJob.cleanup(entry); // 1. Eprint Optional identifier = entry.getField(StandardField.EPRINT); if (StringUtil.isNotBlank(identifier)) { diff --git a/src/test/java/org/jabref/logic/importer/fetcher/ArXivTest.java b/src/test/java/org/jabref/logic/importer/fetcher/ArXivTest.java index 0ed6980ff10..ffb2a25fb3c 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/ArXivTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/ArXivTest.java @@ -102,6 +102,22 @@ void findFullTextByTitleWithCurlyBracket() throws IOException { assertEquals(Optional.of(new URL("https://arxiv.org/pdf/2010.15942v2")), fetcher.findFullText(entry)); } + @Test + void findFullTextByTitleWithColonAndJournalWithoutEprint() throws IOException { + entry.setField(StandardField.TITLE, "Bayes-TrEx: a Bayesian Sampling Approach to Model Transparency by Example"); + entry.setField(StandardField.JOURNAL, "arXiv:2002.10248v4 [cs]"); + + assertEquals(Optional.of(new URL("http://arxiv.org/pdf/2002.10248v4")), fetcher.findFullText(entry)); + } + + @Test + void findFullTextByTitleWithColonAndUrlWithoutEprint() throws IOException { + entry.setField(StandardField.TITLE, "Bayes-TrEx: a Bayesian Sampling Approach to Model Transparency by Example"); + entry.setField(StandardField.URL, "http://arxiv.org/abs/2002.10248v4"); + + assertEquals(Optional.of(new URL("http://arxiv.org/pdf/2002.10248v4")), fetcher.findFullText(entry)); + } + @Test void findFullTextByTitleAndPartOfAuthor() throws IOException { entry.setField(StandardField.TITLE, "Pause Point Spectra in DNA Constant-Force Unzipping");