From 45e2c84631e00d622e086e668409606544972667 Mon Sep 17 00:00:00 2001 From: Stefan Kolb Date: Sat, 14 Mar 2020 02:15:57 +0100 Subject: [PATCH 1/2] Fix inconsistent capitalisation of downloaded files Fixes #6115 --- CHANGELOG.md | 2 ++ .../org/jabref/gui/fieldeditors/LinkedFileViewModel.java | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8917ce7b9f5..03e1a622dde 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,8 @@ 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 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)) From a775858747bb9311696d3b35cd5d058d3d8b91dd Mon Sep 17 00:00:00 2001 From: Stefan Kolb Date: Sat, 14 Mar 2020 11:26:27 +0100 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 03e1a622dde..06ccea5405f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,7 +20,6 @@ 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 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