diff --git a/CHANGELOG.md b/CHANGELOG.md index cdd097ee56d..f9f1ce0c6be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -65,6 +65,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv - We fixed an issue where the `File -> Close library` menu item was not disabled when no library was open. [#10948](https://github.com/JabRef/jabref/issues/10948) - We fixed an issue where the Document Viewer would show the PDF in only half the window when maximized. [#10934](https://github.com/JabRef/jabref/issues/10934) - Clicking on the crossref and related tags in the entry editor jumps to the linked entry. [#5484](https://github.com/JabRef/jabref/issues/5484) [#9369](https://github.com/JabRef/jabref/issues/9369) +- We fixed an issue where JabRef could not parse absolute file paths from Zotero exports [#10959](https://github.com/JabRef/jabref/issues/10959) ### Removed diff --git a/src/main/java/org/jabref/logic/importer/util/FileFieldParser.java b/src/main/java/org/jabref/logic/importer/util/FileFieldParser.java index a180e51c9ad..242671f7ea2 100644 --- a/src/main/java/org/jabref/logic/importer/util/FileFieldParser.java +++ b/src/main/java/org/jabref/logic/importer/util/FileFieldParser.java @@ -102,6 +102,11 @@ public List parse() { // We are at the second : (position 3 in the example) and "just" add it to the current element charactersOfCurrentElement.append(c); windowsPath = true; + // special case for zotero absolute path on windows that do not have a colon in front + // e.g. A:\zotero\paper.pdf + } else if (charactersOfCurrentElement.length() == 1 && value.charAt(i + 1) == '\\') { + charactersOfCurrentElement.append(c); + windowsPath = true; } else { // We are in the next LinkedFile data element linkedFileData.add(charactersOfCurrentElement.toString()); diff --git a/src/test/java/org/jabref/logic/importer/fileformat/BibtexParserTest.java b/src/test/java/org/jabref/logic/importer/fileformat/BibtexParserTest.java index 3c84de494c2..7a118622cfe 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/BibtexParserTest.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/BibtexParserTest.java @@ -75,7 +75,7 @@ /** * Tests for reading whole bib files can be found at {@link org.jabref.logic.importer.fileformat.BibtexImporterTest} *

- * Tests cannot be executed concurrently, because Localization is used at {@link BibtexParser#sparseAndAddEntry(String)} + * Tests cannot be executed concurrently, because Localization is used at {@link BibtexParser#parseAndAddEntry(String)} */ class BibtexParserTest { private static final String BIB_DESK_ROOT_GROUP_NAME = "BibDeskGroups"; diff --git a/src/test/java/org/jabref/logic/importer/util/FileFieldParserTest.java b/src/test/java/org/jabref/logic/importer/util/FileFieldParserTest.java index 1f5e1b17a43..a530aa368c0 100644 --- a/src/test/java/org/jabref/logic/importer/util/FileFieldParserTest.java +++ b/src/test/java/org/jabref/logic/importer/util/FileFieldParserTest.java @@ -203,6 +203,16 @@ private static Stream stringsToParseTest() throws Exception { Arguments.of( Collections.singletonList(new LinkedFile("", "matheus.ea explicit.pdf", "", "https://arxiv.org/pdf/1109.0517.pdf")), ":matheus.ea explicit.pdf::https\\://arxiv.org/pdf/1109.0517.pdf" + ), + // Absolute path + Arguments.of( + Collections.singletonList(new LinkedFile("", "A:\\Zotero\\storage\\test.pdf", "")), + ":A:\\Zotero\\storage\\test.pdf" + ), + // zotero absolute path + Arguments.of( + Collections.singletonList(new LinkedFile("", "A:\\Zotero\\storage\\test.pdf", "")), + "A:\\Zotero\\storage\\test.pdf" ) ); }