diff --git a/CHANGELOG.md b/CHANGELOG.md index 8917ce7b9f5..06ccea5405f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve ### Fixed - We fixed an issue where opening a library from the recent libraries menu was not possible. [#5939](https://github.com/JabRef/jabref/issues/5939) +- We fixed an issue with inconsistent capitalization of file extensions when downloading files [#6115](https://github.com/JabRef/jabref/issues/6115) ### Removed diff --git a/src/main/java/org/jabref/gui/fieldeditors/LinkedFileViewModel.java b/src/main/java/org/jabref/gui/fieldeditors/LinkedFileViewModel.java index 949a05b559f..d16e2b90712 100644 --- a/src/main/java/org/jabref/gui/fieldeditors/LinkedFileViewModel.java +++ b/src/main/java/org/jabref/gui/fieldeditors/LinkedFileViewModel.java @@ -421,10 +421,10 @@ public BackgroundTask prepareDownloadTask(Path targetDirectory, URLDownloa BackgroundTask downloadTask = BackgroundTask .wrap(() -> { Optional suggestedType = inferFileType(urlDownload); - String suggestedTypeName = suggestedType.orElse(StandardExternalFileType.PDF).getName(); + ExternalFileType externalFileType = suggestedType.orElse(StandardExternalFileType.PDF); + String suggestedTypeName = externalFileType.getName(); linkedFile.setFileType(suggestedTypeName); - - String suggestedName = linkedFileHandler.getSuggestedFileName(suggestedTypeName); + String suggestedName = linkedFileHandler.getSuggestedFileName(externalFileType.getExtension()); return targetDirectory.resolve(suggestedName); }) .then(destination -> new FileDownloadTask(urlDownload.getSource(), destination))