From 96807fdfe5dd9abb6de567faa9ac38255d7fde15 Mon Sep 17 00:00:00 2001 From: John Besse Date: Thu, 25 Apr 2019 00:37:35 -0400 Subject: [PATCH] #4913 Bug - Downloads from the arXiv are marked as HTML files instead of PDF may have found where to edit --- .../java/org/jabref/logic/importer/fetcher/ArXiv.java | 2 +- .../java/org/jabref/logic/importer/fetcher/ArXivTest.java | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) 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 7db5d5f3a2a..8f4c7d711e6 100644 --- a/src/main/java/org/jabref/logic/importer/fetcher/ArXiv.java +++ b/src/main/java/org/jabref/logic/importer/fetcher/ArXiv.java @@ -334,6 +334,7 @@ public ArXivEntry(Node item) { if (linkTitle.equals(Optional.of("pdf"))) { pdfUrlParsed = XMLUtil.getAttributeContent(linkNode, "href").map(url -> { try { + //#4913 bug return new URL(url); } catch (MalformedURLException e) { return null; @@ -341,7 +342,6 @@ public ArXivEntry(Node item) { }); } } - //#4913 bug pdfUrl = pdfUrlParsed; // Associated DOI 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 ae71b8849c7..35a8983589c 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/ArXivTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/ArXivTest.java @@ -66,6 +66,14 @@ public void findFullTextByDOI() throws IOException { assertEquals(Optional.of(new URL("http://arxiv.org/pdf/cond-mat/0406246v1")), finder.findFullText(entry)); } + @Test + public void givenTestBibentry_whenfindFullText_thenFindFullTextByDOIWithPDFFileTypeSuffixAdded() throws IOException { + entry.setField(FieldName.DOI, "10.1529/biophysj.104.047340"); + entry.setField(FieldName.TITLE, "Pause Point Spectra in DNA Constant-Force Unzipping"); + + assertEquals(Optional.of(new URL("http://arxiv.org/pdf/cond-mat/0406246v1.pdf")), finder.findFullText(entry)); + } + @Test public void findFullTextByEprint() throws IOException { entry.setField("eprint", "1603.06570");