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 file renaming #12556

Open
koppor opened this issue Feb 24, 2025 · 3 comments
Open

Fix file renaming #12556

koppor opened this issue Feb 24, 2025 · 3 comments
Assignees
Labels
📍 Assigned Assigned by assign-issue-action (or manually assigned) component: external-files good first issue An issue intended for project-newcomers. Varies in difficulty.

Comments

@koppor
Copy link
Member

koppor commented Feb 24, 2025

  1. Start JabRef
  2. Check preferences that the citation key pattern for files is [bibtexkey] - [title]
    Image
  3. Create new library
  4. Save library to folder main/src/test/resources/pdfs/PdfContentImporter
  5. Drag an drop file Bogner2023.pdf from main/src/test/resources/pdfs/PdfContentImporter
  6. Go to tab "General"
  7. Scroll down to "File"
  8. Right click and select"Edit"
    Image
  9. See that filename misses citatoin key
    Image
  10. Select "Quality" > "Cleanup entries"
  11. Ensure that "Rename PDFs to given filename format pattern" is checked.
  12. Click OK
    Image
  13. In the warning, click "Autogenerate PDF Names"
    Image
  14. Click on "Edit" again. See that citation key is in:
    Image

Wish: File should have correct name after import.

Task:

  1. Understand what happens at drag and drop
  2. Ensure that citaton key generation happens before file name renaming

If 2 is not possible, report back, why.


Risen by #12540

@beginner003
Copy link

/assign-me

@github-actions github-actions bot added the 📍 Assigned Assigned by assign-issue-action (or manually assigned) label Feb 27, 2025
Copy link
Contributor

👋 Hey @beginner003, thank you for your interest in this issue! 🎉

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! 🚀

⏳ Please note, you will be automatically unassigned if the issue isn't closed within 45 days (by 13 April 2025). A maintainer can also add the "📌 Pinned"" label to prevent automatic unassignment.

@subhramit subhramit moved this from Free to take to Assigned in Good First Issues Mar 4, 2025
@edgarwolff
Copy link

The bug essitially comes from the fact that when the interaction process from the EventHandler gets through the lambda in MaintTable to the ImportHandler.java file the call at line ImportHandler::162 to DragDrop::handleDropOfFiles that induces the file copy the BibEntry's String key is not defined yet.
This key is defined when later at line ImportHandler::201 the call to ImportHandler::importEntries in a separate async threadis indeed executed.
To tackle this problem, a fix is to call the method in charge of this generation before the file importation by inserting a call such as generateKeys(Collections.singletonList(entry)); right before the current line 162 of the file ImportHandler.java
This has no noticeable side effect on other functionnalities behavior and fixes the bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📍 Assigned Assigned by assign-issue-action (or manually assigned) component: external-files good first issue An issue intended for project-newcomers. Varies in difficulty.
Projects
Status: Assigned
Development

No branches or pull requests

3 participants