jabref icon indicating copy to clipboard operation
jabref copied to clipboard

Importing bib file shows message that it's importing "unknown format"

Open ror3d opened this issue 1 year ago • 4 comments

JabRef version

Latest development branch build (please note build date below)

Operating system

Windows

Details on version and operating system

Windows 11

Checked with the latest development build (copy version output from About dialog)

  • [X] I made a backup of my libraries before testing the latest development version.
  • [X] I have tested the latest development version and the problem persists

Steps to reproduce the behaviour

  1. Open any bib file
  2. File > Import > Import into current library
  3. Without changing the file filter of the open dialog,
  4. Choose any other bib file (the same bib file also reproduces the error)
  5. Notice that a message pops up saying that it's importing the given file as "unknown format"

Looking at the code in org/jabref/gui/importer/ImportCommand.java, it seems that the import code is using the selected file filter in the dialog to choose the importing class, but if the filter is set to "Any file (.)" then it gets confused somehow.

I feel like the filter could be used as a hint, the same way that the file extension is usually used as a hint, but saying that the format is unknown when it's clearly a bib file is confusing.

Edit: upon further testing, this has ramifications. It seems that if the file format is "unknown", groups from the imported file won't be imported into the library. Steps to reproduce this:

  1. Open any bib file
  2. File > Import > Import into current library
  3. Without changing the file filter of the open dialog,
  4. Choose another bib file saved from jabref that has groups and entries with groups assigned
  5. Notice the popup about "unknown format"
  6. Import everything in that file
  7. Save the file, close it, and open it again
  8. Notice that the groups were not imported

as opposed to using the "right" file type filter:

  1. Open any bib file
  2. File > Import > Import into current library
  3. Choose *.bib as the file type filter in the dialog
  4. Choose another bib file saved from jabref that has groups and entries with groups assigned
  5. Notice the popup about "importing from bibtex"
  6. Import everything in that file
  7. Save the file, close it, and open it again (apparently the groups list is not updated after importing, only after reloading)
  8. Notice that the groups were properly imported

Appendix

image

image

ror3d avatar Mar 14 '24 11:03 ror3d

@ror3d Thank you for looking at the code. I think, it will be propagate the kind of import. Let's see how it will work out for you :) - We are reachable on Skype BTW. You can ping us there (find me with "koppor")

koppor avatar Mar 14 '24 11:03 koppor

Actually, upon further testing, this also causes problems because it then doesn't import groups. I'll update the issue.

ror3d avatar Mar 14 '24 11:03 ror3d

About reaching out, I appreciate it but I only have very little time that I can put into working on these, so I hope with these details someone else can work on it and fix this.

ror3d avatar Mar 14 '24 12:03 ror3d

About reaching out, I appreciate it but I only have very little time that I can put into working on these, so I hope with these details someone else can work on it and fix this.

It's a procrastination project for all of us 🤣🤣

koppor avatar Mar 14 '24 12:03 koppor