diff --git a/CHANGELOG.md b/CHANGELOG.md index d6a0100fe1a..a2e256d75b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve ### Fixed +- We fixed an issue where an exception ocurred when a linked online file was edited in the entry editor [#8008](https://github.com/JabRef/jabref/issues/8008) - We fixed an issue when checking for a new version when JabRef is used behind a corporate proxy. [#7884](https://github.com/JabRef/jabref/issues/7884) - We fixed some icons that were drawn in the wrong color when JabRef used a custom theme. [#7853](https://github.com/JabRef/jabref/issues/7853) - We fixed an issue where the `Aux file` on `Edit group` doesn't support relative sub-directories path to import. [#7719](https://github.com/JabRef/jabref/issues/7719). diff --git a/src/main/java/org/jabref/gui/linkedfile/LinkedFilesEditDialogViewModel.java b/src/main/java/org/jabref/gui/linkedfile/LinkedFilesEditDialogViewModel.java index 23104e7eafb..b69789282f9 100644 --- a/src/main/java/org/jabref/gui/linkedfile/LinkedFilesEditDialogViewModel.java +++ b/src/main/java/org/jabref/gui/linkedfile/LinkedFilesEditDialogViewModel.java @@ -1,5 +1,7 @@ package org.jabref.gui.linkedfile; +import java.net.MalformedURLException; +import java.net.URL; import java.nio.file.Path; import java.util.List; import java.util.Optional; @@ -125,7 +127,16 @@ public ObjectProperty selectedExternalFileTypeProperty() { } public LinkedFile getNewLinkedFile() { - return new LinkedFile(description.getValue(), Path.of(link.getValue()), monadicSelectedExternalFileType.getValue().map(ExternalFileType::toString).orElse("")); + String fileType = monadicSelectedExternalFileType.getValue().map(ExternalFileType::toString).orElse(""); + + if (LinkedFile.isOnlineLink(link.getValue())) { + try { + return new LinkedFile(description.getValue(), new URL(link.getValue()), fileType); + } catch (MalformedURLException e) { + return new LinkedFile(description.getValue(), link.getValue(), fileType); + } + } + return new LinkedFile(description.getValue(), Path.of(link.getValue()), fileType); } private String relativize(Path filePath) {