Skip to content

Commit

Permalink
Fix copy drag and drop action (#5671)
Browse files Browse the repository at this point in the history
Fixes #5653.
  • Loading branch information
tobiasdiez authored and koppor committed Nov 24, 2019
1 parent d0393b5 commit ece9820
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
- After assigning an entry to a group, the item count is now properly colored to reflect the new membership of the entry. [#3112](https://github.com/JabRef/jabref/issues/3112)
- The group panel is now properly updated when switching between libraries (or when closing/opening one). [#3142](https://github.com/JabRef/jabref/issues/3142)
- We fixed an error where the number of matched entries shown in the group pane was not updated correctly. [#4441](https://github.com/JabRef/jabref/issues/4441)
- We fixed an error where the wrong file is renamed and linked when using the "Copy, rename and link" action. [#5653](https://github.com/JabRef/jabref/issues/5653)
- We fixed a "null" error when writing XMP metadata. [#5449](https://github.com/JabRef/jabref/issues/5449)
- We fixed an issue where empty keywords lead to a strange display of automatic keyword groups. [#5333](https://github.com/JabRef/jabref/issues/5333)
- We fixed an error where the default color of a new group was white instead of dark gray. [#4868](https://github.com/JabRef/jabref/issues/4868)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.jabref.gui.externalfiles;

import java.nio.file.Path;
import java.util.Collections;
import java.util.List;
import java.util.Optional;

Expand Down Expand Up @@ -36,7 +37,7 @@ public Optional<Path> copyFileToFileDir(Path file) {
if (firstExistingFileDir.isPresent()) {
Path targetFile = firstExistingFileDir.get().resolve(file.getFileName());
if (FileUtil.copyFile(file, targetFile, false)) {
return Optional.ofNullable(targetFile);
return Optional.of(targetFile);
}
}
return Optional.empty();
Expand Down Expand Up @@ -71,7 +72,7 @@ public void moveFilesToFileDirAndAddToEntry(BibEntry entry, List<Path> files) {
public void copyFilesToFileDirAndAddToEntry(BibEntry entry, List<Path> files) {
for (Path file : files) {
copyFileToFileDir(file)
.ifPresent(copiedFile -> addFilesToEntry(entry, files));
.ifPresent(copiedFile -> addFilesToEntry(entry, Collections.singletonList(copiedFile)));
}
renameLinkedFilesToPattern(entry);
}
Expand Down

0 comments on commit ece9820

Please sign in to comment.