From 12377cde86a3e3b65bcd0e0a03b12d07b5e4f912 Mon Sep 17 00:00:00 2001 From: Oliver Kopp Date: Mon, 5 Dec 2022 21:38:33 +0100 Subject: [PATCH 1/3] Return absolute path in case an absolute one is given Co-authored-by: Christoph Co-authored-by: Carl Christian Snethlage <50491877+calixtus@users.noreply.github.com> Co-authored-by: ThiloteE <73715071+ThiloteE@users.noreply.github.com> --- src/main/java/org/jabref/model/util/FileHelper.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main/java/org/jabref/model/util/FileHelper.java b/src/main/java/org/jabref/model/util/FileHelper.java index f2ab92419b7..fcfe0ce9499 100644 --- a/src/main/java/org/jabref/model/util/FileHelper.java +++ b/src/main/java/org/jabref/model/util/FileHelper.java @@ -115,6 +115,7 @@ private static Optional detectExtension(InputStream is, Metadata metaDat * @param fileName The filename, may also be a relative path to the file */ public static Optional find(final BibDatabaseContext databaseContext, String fileName, FilePreferences filePreferences) { + Objects.requireNonNull(fileName, "fileName"); return find(fileName, databaseContext.getFileDirectories(filePreferences)); } @@ -126,6 +127,16 @@ public static Optional find(final BibDatabaseContext databaseContext, Stri * returning the first found file to match if any. */ public static Optional find(String fileName, List directories) { + if (directories.isEmpty()) { + // Fallback, if no directories to resolve are passed + Path path = Path.of(fileName); + if (path.isAbsolute()) { + return Optional.of(path); + } else { + return Optional.empty(); + } + } + return directories.stream() .flatMap(directory -> find(fileName, directory).stream()) .findFirst(); From 2a78a36cb69a8957c3e087571c9a7e90fd95f23b Mon Sep 17 00:00:00 2001 From: Oliver Kopp Date: Mon, 5 Dec 2022 21:42:20 +0100 Subject: [PATCH 2/3] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f3d1725a8a4..9e92fcbe337 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -85,6 +85,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve - We fixed an issue with the message that is displayed when fetcher returns an empty list of entries for given query. [#9195](https://github.com/JabRef/jabref/issues/9195) - We fixed an issue where an exception was not logged correctly. [koppor#627](https://github.com/JabRef/koppor/issues/627) - We fixed an issue where hitting enter on the search field within the preferences dialog closed the dialog. [koppor#630](https://github.com/koppor/jabref/issues/630) +- We fixed an issue where a user could not open an attached file. [#9386](https://github.com/JabRef/jabref/issues/9386) - We fixed a typo within a connection error message. [koppor#625](https://github.com/koppor/jabref/issues/625) - We fixed an issue where the 'close dialog' key binding was not closing the Preferences dialog. [#8888](https://github.com/jabref/jabref/issues/8888) - We fixed an issue where editing entry's "date" field in library mode "biblatex" causes an uncaught exception. [#8747](https://github.com/JabRef/jabref/issues/8747) From 52b9712c5479ab3c874ab487c710ceeacfa3e820 Mon Sep 17 00:00:00 2001 From: Oliver Kopp Date: Mon, 5 Dec 2022 21:47:07 +0100 Subject: [PATCH 3/3] Update CHANGELOG.md Co-authored-by: Christoph --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e92fcbe337..615c4b88c48 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -85,7 +85,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve - We fixed an issue with the message that is displayed when fetcher returns an empty list of entries for given query. [#9195](https://github.com/JabRef/jabref/issues/9195) - We fixed an issue where an exception was not logged correctly. [koppor#627](https://github.com/JabRef/koppor/issues/627) - We fixed an issue where hitting enter on the search field within the preferences dialog closed the dialog. [koppor#630](https://github.com/koppor/jabref/issues/630) -- We fixed an issue where a user could not open an attached file. [#9386](https://github.com/JabRef/jabref/issues/9386) +- We fixed an issue where a user could not open an attached file in a new unsaved library. [#9386](https://github.com/JabRef/jabref/issues/9386) - We fixed a typo within a connection error message. [koppor#625](https://github.com/koppor/jabref/issues/625) - We fixed an issue where the 'close dialog' key binding was not closing the Preferences dialog. [#8888](https://github.com/jabref/jabref/issues/8888) - We fixed an issue where editing entry's "date" field in library mode "biblatex" causes an uncaught exception. [#8747](https://github.com/JabRef/jabref/issues/8747)