Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix copy drag and drop action #5671

Merged
merged 1 commit into from
Nov 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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