-
-
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
If user moved file, it should simply be relinked #9798
Comments
Hello my name is Alexandra Stathopoulou and i am an academic student in a greek University. For my semester course I have been asked to contribute in an open source software project and i would like to take on this issue. |
As a general advice for newcomers: check out Contributing for a start. Also, guidelines for setting up a local workspace is worth having a look at. Feel free to ask here at GitHub, if you have any issue related questions. If you have questions about how to setup your workspace use JabRef's Gitter chat. Try to open a (draft) pull-request early on, so that people can see you are working on the issue and so that they can see the direction the pull request is heading towards. This way, you will likely receive valuable feedback. |
Would be great to see this! Only question is, should this be always done automatically? Especially for some cases this might create wrong links (before two files "a.pdf" exist at different places; user deletes one; now the other "a.pdf" gets linked, although it's possibly different). |
@claell The "First Implementation" is fully automatic. The second one has a user check build in. May I ask if your described case is an edge case? OK, there could be "download.pdf" being linked. Howver, JabRef supports one with renaming files to a pattern. The default is even |
Regarding the described case: Yes, this is an edge case, but robust implementations should cover such edge cases to not create wrong data. |
Hello there, I have been looking through the issue for the first implementation and this is the solution I have come up with: First, when the Search for unlinked local files is initiated, the program should first review all the entries of the current library where the file input is filled. For those entries, the program should check if the file name and the full path are valid (exists and matches to some file in the local folders). If either of these do not exist then the entry name (entry ID) should be kept in an array, as well as the file’s name. If (a) the file is not found, or (b) the path is not recognized and a file with the same name is found in a different folder the user should be informed with the display of the right message. Also, the user should be advised to (a) delete the file input or (b) change the file path. If this is the case, a fitting message shall appear on the screen informing the user that: b) The file path of an entry is not matched and a file with the specific name is found in the local folder. For example, as mentioned in the issue the message shall be: a) Entry: test, file: a.pdf b) Entry: test, file: a.pdf Lastly, when the Automatically set files link key is pressed the program shall change the file path to the new full path of the file with the same name found unless more than one file has the same name. Please inform me about your thoughts on this approach. Kind regards, |
Can you describe how citavi names the files? We surely could make a notification listing all entries having non-existant files, but other entries with the same filename. (In the case for auto linking). Then, the user can manually investigate. |
Yeah! Currently, JabRef tries magically to resolve the file link, which causes confusion sometimes: #9800 |
Your description starts well. Then, I have some comments:
You do not need an ordering (which an array provides). It should be another data structure. Maybe
The array contains files not existing any more, now you add existing files?
Nothing with prompts please. JabRef should do "magic" here (because it is "automatically set file links). Prompts should be done in the second option ("Follow-up implementation"). The second one is "Files -> Find unlinked files" with a UI.
A user put the file into the
The automatically set file links should work perfectly when selecting all entries of the library.
This is the intention. Building a data structure based on the existing entries and the file system is necessary for it. |
That would be great (also for other use cases). I don't exactly remember right now; will investigate. |
Here is an example from a .bib export from Citavi (the colons seem to be Citavi specific?):
The name is from the file that I added as attachment directly in Citavi. However, I also have that file stored separately on my drive with that name. If deemed sensible, I can open a new issue for Citavi, as it might require treating this specific export format. |
I like that behavior, just that it doesn't give options there when it cannot find the file. But that might need general consideration of UX, considering that the whole behavior might get changed a bit with the idea in this issue. |
@Alexandra-Stath Will you continue working on this or will you focus on other issues? |
@koppor |
Hi @koppor, I worked on Linked identifier for ISBNs issue recently. I want to take this up. Shall I ? |
As a general advice for newcomers: check out Contributing for a start. Also, guidelines for setting up a local workspace is worth having a look at. Feel free to ask here at GitHub, if you have any issue related questions. If you have questions about how to setup your workspace use JabRef's Gitter chat. Try to open a (draft) pull-request early on, so that people can see you are working on the issue and so that they can see the direction the pull request is heading towards. This way, you will likely receive valuable feedback. |
@Maja-Larsson Sure thing! I assigned you only, because GitHub allows only to assign commenters of an issue. Note that this issue is more about requirements engineering and developing test cases than the actual implementation. Thus, use this as chance to learn about JUnit and test-driven development. In practice, this means: Write tests, use the "Debug" button to execute the tests and let the IDE suspend on breakpoints. See how the code behaves. Adapt it. Re-run. Until the test is green. Then, the next test. |
We added file relinking functionality after a file is moved when clicking the "Automatically set file links" button. Implementation based and improved upon work done in closed issue [JabRef#10526]. [JabRef#9798]
Hi! Our group (assigned to Maja-Larsson ) made a version of the First implementation based on the work done previously by u74981018 in issue #10526 . The relevant work you can see done in the pull request above. Would love to hear feedback and receive further insight! Thank you! |
Our course have unfortunately ended and we will not be able to continue working on this issue. I will unassign me from this and I hope we have contributed to the issue in some way! Thanks for all the feedback! |
Hi, I'm working with a group of 2 other CS students from Florida International University. We are part of the Tech Talent Academy program where we are required to join an open source project and make a contribution. We were wondering if we could tackle this issue. |
I assigned you to the other issue already |
Hello! I'm a university student who is interested in working on this issue as part of a school assignment. Is it still available? If it is, could I please have it assigned to me? This would be my first time contributing to an open source project. Thank you! |
Welcome to the vibrant world of open-source development with JabRef! Newcomers, we're excited to have you on board. Start by exploring our Contributing guidelines, and don't forget to check out our workspace setup guidelines to get started smoothly. In case you encounter failing tests during development, please check our developer FAQs! Having any questions or issues? Feel free to ask here on GitHub. Need help setting up your local workspace? Join the conversation on JabRef's Gitter chat. And don't hesitate to open a (draft) pull request early on to show the direction it is heading towards. This way, you will receive valuable feedback. Happy coding! 🚀 |
…s improvement on issue [JabRef#9798](JabRef#9798)
…s improvement, automatically relink a file if it is moved. On issue [JabRef#9798](JabRef#9798)
Start:
File
a.pdf
existsUser moves
a.pdf
intofolder-a
.When "Find unlinked files" is started, JabRef should
a.pdf
oftest
is missingfolder-a/a.pdf
does not belong to any entrytest
froma.pdf
tofolder-a/a.pdf
If
a.pdf
exists multiple times, no rewrite should be done.First implementation
The functionality should be in "Automatically set file links" (Quality -> Automatically set file links). In case it is absolutely sure that the file was moved (i.e., no two files with the same name), they should be moved.
Current output:
Follow-up implementation
The "Search for unlinked files" (Lookup -> Find unlinked files) dialog should get two columns as search result. Currently 1.
In case no candidate entry exists, "" is put in. In case two (or more) candidate entries exist, the cell turns into a dropdown. The jump link is next to the drop down.
Update 2024-01-09: Testing effort high is serious. Crafting test cases for different scenarios is necessary. See especially the comment at #9798 (comment).
Update 2024-03-05: Testing effort high is really serious. A single test case is not enough. The PR #10526 showed an initial test case. -- One could think of using https://github.com/google/jimfs for more advanced tests. However
@TempDir
with some files should be enough.The text was updated successfully, but these errors were encountered: