Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes Zotero file handling for absolute paths #11038

Merged
merged 4 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ public List<LinkedFile> 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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
/**
* Tests for reading whole bib files can be found at {@link org.jabref.logic.importer.fileformat.BibtexImporterTest}
* <p>
* 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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,16 @@ private static Stream<Arguments> 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"
)
);
}
Expand Down
Loading