-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Fix/copy linked files on entry transfer #13535
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
base: main
Are you sure you want to change the base?
Fix/copy linked files on entry transfer #13535
Conversation
Allows tracking the source BibDatabaseContext for later use in pasteEntry()
…er and setter Enables tracking the source database context for use in pasteEntry()
… CopyTo#copyEntriesWithFeedback and LibraryTab#pasteEntry
Add filePreferences parameter to CopyTo.java to enable LinkedFile#findIn functionality
… primary directory
…sferHelperTest#isReachableFromPrimaryDirectory method
Cloning the BibEntry in importEntryWithDuplicateCheck to ensure that any file path adjustments during the copy/paste process do not affect the original entry in the source database. This avoids side effects when imported entries are modified (e.g. file links), especially when the same BibEntry instance is shared between databases.
…ls in LibraryTab and CopyTo to align with new method signature
…pying logic during entry transfer
jablib/src/test/java/org/jabref/logic/externalfiles/LinkedFileTransferHelperTest.java
Outdated
Show resolved
Hide resolved
jablib/src/test/java/org/jabref/logic/externalfiles/LinkedFileTransferHelperTest.java
Outdated
Show resolved
Hide resolved
jablib/src/test/java/org/jabref/logic/externalfiles/LinkedFileTransferHelperTest.java
Outdated
Show resolved
Hide resolved
jablib/src/test/java/org/jabref/logic/externalfiles/LinkedFileTransferHelperTest.java
Outdated
Show resolved
Hide resolved
…he heading leven only by one
…change to collection constructors again
… remove unnecessary throws clauses
You ticked that you modified If you made changes that are visible to the user, please add a brief description along with the issue number to the |
FilePreferences filePreferences | ||
) { | ||
|
||
Set<BibEntry> modifiedEntries = new HashSet<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using constructor for HashSet instead of modern Java collection factory method Set.of(). Modern Java practices recommend using factory methods for cleaner and more maintainable code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could not find a quick solution. would have to refactor the logic then.
|
||
for (BibEntry entry : targetContext.getEntries()) { | ||
boolean entryChanged = false; | ||
List<LinkedFile> linkedFiles = new ArrayList<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using ArrayList constructor instead of modern Java collection factory methods. Should use List.of() for empty list initialization following JabRef's conventions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could not find a quick solution. would have to refactor the logic then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TracBot is wrong here 😅
JUnit tests of You can then run these tests in IntelliJ to reproduce the failing tests locally. We offer a quick test running howto in the section Final build system checks in our setup guide. |
Closes #12267
Adds a requirements specification file
files.md
documenting the linked file transfer logic between BibTeX entries in JabRef.The document captures three key scenarios for when linked files are reachable or not in the target context and the expected behavior regarding path adjustment and file copying.
This improves traceability by formally specifying requirements that are linked to implementation and tests via OpenFastTrace.
Steps to test
Verify that the new requirements specification file
docs/requirements/files.md
is present, properly formatted, and follows JabRef conventions.Run all existing and new unit tests in
LinkedFileTransferHelperTest
to ensure the linked file transfer logic behaves correctly across all covered scenarios.Manually verify the business logic in JabRef, especially for the scenario where the linked file is not reachable and a nested directory structure must be created. Reviewers should confirm that the path adjustments and file copying behavior conform to the requirements.
Provide feedback if the handling of the last case (unreachable file with differing paths) aligns with project expectations.
Mandatory checks
CHANGELOG.md
described in a way that is understandable for the average user (if change is visible to the user)