-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Implemented Method to Allow File to be Relinked if the User Moved the File, Added Tests to Test the Method #12110
base: main
Are you sure you want to change the base?
Conversation
…by Le-Chat-BottE)
…h file name changing workaround to account for the faulty filteringFunction method in CitationKeyBasedFileFinder.java (Co-authored by Le-Chat-BottE)
…eFileFromSubfolderToRootFolder, relinkMoveFileFromSubfolderToSubfolder, noRelinkCopyFileFromRootFolderToSubfolder, noRelinkCopyFileFromSubfolderToRootFolder, noRelinkCopyFileFromSubfolderToSubfolder) in AutoSetFileLinksUtilTest.java (Co-authored by Le-Chat-BottE)
…fix-for-koppor-issue-9798 # Conflicts: # src/test/java/org/jabref/gui/externalfiles/AutoSetFileLinksUtilTest.java
…s improvement on issue [JabRef#9798](JabRef#9798)
…s improvement, automatically relink a file if it is moved. On issue [JabRef#9798](JabRef#9798)
…fix-for-koppor-issue-9798
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.
Logik is with flaws, if mutiple files are linked to an entry (e.g., coverage). It does not work.
Please improve.
// If file that is already linked to an existing entry is moved, the file should be relinked to the entry | ||
private void relinkFileIfMoved(List<LinkedFile> newLinkedFiles, BibEntry entry) { | ||
// Get the list of files linked to a specific entry | ||
List<LinkedFile> allLinkedFiles = entry.getField(StandardField.FILE).map(FileFieldParser::parse).orElse(Collections.emptyList()); |
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.
Use entry.getFiles()
Hey @u7754676 |
This fix was co-written by Le-Chat-BottE and I. We have implemented the "Automatically set file links" feature. Specifically, this was the implementation described under the heading "First Implementation" in the original issue #9798. Our implementation comes in the form of the addition of the new method relinkFileIfMoved in the AutoSetFileLinks.java file.
In addition, as requested in the issue itself, we have also created 6 new tests to test this new method, located in the AutoSetFileLinksUtilTest.java file. The 6 tests are as follows:
We think our code is ready for review and we welcome any feedback or suggestions. Thank you!
Fixes #9798.
Mandatory checks
CHANGELOG.md
described in a way that is understandable for the average user (if change is visible to the user)