Skip to content

Add support for book front covers#14330

Merged
Siedlerchr merged 119 commits into
JabRef:mainfrom
bblhd:feature/book-front-cover-10120
Jan 1, 2026
Merged

Add support for book front covers#14330
Siedlerchr merged 119 commits into
JabRef:mainfrom
bblhd:feature/book-front-cover-10120

Conversation

@bblhd

@bblhd bblhd commented Nov 16, 2025

Copy link
Copy Markdown
Contributor

Closes #10120

This pull request adds support for cover images which can display in the preview of entries. It also allows new entries to automatically download cover images from either "https://bookcover.longitood.com" or "https://covers.openlibrary.org", and preferences to control downloading behaviour. Key changes are:

  • The ability for PreviewViewer to display images
  • A new BookCoverFetcher class to download cover images
  • Hooks in NewEntryViewModel to do cover fetching
  • New options in FilePreferences and LinkedFilesTab

Steps to test

  1. Add a new entry using the ISBN "978-1449310509", if you open the preview for the new entry, the cover image should be visible.
  2. Under File > Preferences, in the Linked Files tab, disable the "Automatically download cover images" setting.
  3. Add a new entry using the ISBN "978-1449373320", there should be no cover image if you open the preview.

Mandatory checks

Images

jabref-book-covers-preview jabref-book-covers-preferences

@github-actions

Copy link
Copy Markdown
Contributor

Hey @bblhd!

Thank you for contributing to JabRef! Your help is truly appreciated ❤️.

We have automatic checks in place, based on which you will soon get automated feedback if any of them are failing. We also use TragBot with custom rules that scans your changes and provides some preliminary comments, before a maintainer takes a look. TragBot is still learning, and may not always be accurate. In the "Files changed" tab, you can go through its comments and just click on "Resolve conversation" if you are sure that it is incorrect, or comment on the conversation if you are doubtful.

Please re-check our contribution guide in case of any other doubts related to our contribution workflow.

Comment thread jabgui/src/main/java/org/jabref/gui/importer/BookCoverFetcher.java Outdated
Comment thread jablib/src/main/java/org/jabref/logic/util/URLUtil.java
@bblhd

bblhd commented Nov 17, 2025

Copy link
Copy Markdown
Contributor Author

I have attempted to unmodify submodules without success, both in the past and currently, though I was unaware how much of a problem it was.

I've tried all suggested fixes unsuccessfully, either commit ids are not found or the commands have no effect at all. It seems to be something wrong with my version of git or my repository. For context, I'm using git version 2.51.2_1, on linux, with a basic command line and no IDE.

In theory, this could be fixed by creating a new branch and pull request, but the contributors guide specifically requests not to.

Does anyone know how to solve this?

Commit: bb58664
Diffs: csl-locales, csl-styles

@bblhd

bblhd commented Nov 17, 2025

Copy link
Copy Markdown
Contributor Author

I have attempted to unmodify submodules without success, both in the past and currently, though I was unaware how much of a problem it was.

I've tried all suggested fixes unsuccessfully, either commit ids are not found or the commands have no effect at all. It seems to be something wrong with my version of git or my repository. For context, I'm using git version 2.51.2_1, on linux, with a basic command line and no IDE.

In theory, this could be fixed by creating a new branch and pull request, but the contributors guide specifically requests not to.

Does anyone know how to solve this?

Commit: bb58664 Diffs: csl-locales, csl-styles

Fixed this by doing submodule checkout in IntelliJ IDEA, unsure what exactly the issue was, but submodules are now unmodified from main.

@bblhd bblhd force-pushed the feature/book-front-cover-10120 branch from 0b644fd to 2c61ef3 Compare November 17, 2025 13:55
@bblhd

bblhd commented Nov 17, 2025

Copy link
Copy Markdown
Contributor Author

I apologise for force pushing, the only difference was a single incorrect author email in the previous commit I pushed.

@InAnYan

InAnYan commented Nov 17, 2025

Copy link
Copy Markdown
Member

Hi, bblhd! Thank you for looking into this feature. This is a very good issue for the first contribution!

Siedlerchr
Siedlerchr previously approved these changes Jan 1, 2026
@Siedlerchr

Copy link
Copy Markdown
Member

The External File Prefs were touched here #14619
I will create a follow up issue @calixtus

@jabref-machine

Copy link
Copy Markdown
Collaborator

While the PR was in progress, a new version of JabRef has been released.

You have to merge upstream/main and move your entry in CHANGELOG.md up to the section ## [Unreleased].

@Siedlerchr Siedlerchr enabled auto-merge January 1, 2026 16:01

@subhramit subhramit left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm

@Siedlerchr Siedlerchr added this pull request to the merge queue Jan 1, 2026
Merged via the queue into JabRef:main with commit 0ad7003 Jan 1, 2026
51 of 52 checks passed
@subhramit

Copy link
Copy Markdown
Member

There is a failing check on merge: https://github.com/JabRef/jabref/actions/runs/20642230526/job/59275496096
@bblhd could you investigate if related/actionable?

@subhramit

Copy link
Copy Markdown
Member

Yep, they do seem relevant:

              LinkedFileTransferHelperTest

                check(FileTestConfigurationBuilder, BibTestConfigurationBuilder, BibTestConfigurationBuilder)

                  Test "path/to/file.pdf" with "pdf" should be "file.pdf" with empty citation key FAILED

                  org.opentest4j.AssertionFailedError: expected: <file.pdf> but was: <path/to/file.pdf>
                      at app/org.jabref.jablib/org.jabref.logic.externalfiles.LinkedFileHandlerTest.getSuggestedFileNameWithMissingKey(LinkedFileHandlerTest.java:116)


                  getSuggestedFileName(String, String, String)

                    Test "path/to/other.pdf" with "pdf" should be "other.pdf" with empty citation key FAILED

                    org.opentest4j.AssertionFailedError: expected: <other.pdf> but was: <path/to/other.pdf>
                        at app/org.jabref.jablib/org.jabref.logic.externalfiles.LinkedFileHandlerTest.getSuggestedFileNameWithMissingKey(LinkedFileHandlerTest.java:116)


    BibtexParserTest

      CitaviXmlImporterFilesTest

        FileUtilTest

          checkFileExtensionAreTheSameForStringsAndPaths(String)

            Test [2] "te.st.PdF  " FAILED

            java.nio.file.InvalidPathException: Trailing char < > at index 10: te.st.PdF
                at org.jabref.jablib/org.jabref.logic.util.io.FileUtilTest.checkFileExtensionAreTheSameForStringsAndPaths(FileUtilTest.java:255)

Siedlerchr added a commit that referenced this pull request Jan 1, 2026
@Siedlerchr

Copy link
Copy Markdown
Member

They are failing on Windows

Siedlerchr added a commit that referenced this pull request Jan 1, 2026
Siedlerchr added a commit that referenced this pull request Jan 1, 2026
Siedlerchr added a commit that referenced this pull request Jan 1, 2026
@Siedlerchr

Copy link
Copy Markdown
Member

I reverted the PR for now due to the failng window tests, you can re-create it or re.open this one

@calixtus

calixtus commented Jan 1, 2026

Copy link
Copy Markdown
Member

Very strange the failing test did not show up in CI on this PR

@subhramit

Copy link
Copy Markdown
Member

Very strange the failing test did not show up in CI on this PR

Yeah that is on us.
After splitting JabRef into CLI, GUI. library and server, the windows tests were taking excruciatingly long (30+min, if I remember correctly) to finish. @koppor and I finally decided that we will skip the jablib windows test on PR commits, as ~95% PRs don't deal with paths, and even less deal with paths in a way that requires differentiated handling for windows.

This PR was one of them 😄

@subhramit

subhramit commented Jan 1, 2026

Copy link
Copy Markdown
Member

Very strange the failing test did not show up in CI on this PR

Yeah that is on us. After splitting JabRef into CLI, GUI. library and server, the windows tests were taking excruciatingly long (30+min, if I remember correctly) to finish. @koppor and I finally decided that we will skip the jablib windows test on PR commits, as ~95% PRs don't deal with paths, and even less deal with paths in a way that requires differentiated handling for windows.

This PR was one of them 😄

@koppor lets make a new workflow based on an old idea - File system related classes touched in a commit => jablib windows test runs

@bblhd

bblhd commented Jan 2, 2026

Copy link
Copy Markdown
Contributor Author

Yep, they do seem relevant:

              LinkedFileTransferHelperTest

                check(FileTestConfigurationBuilder, BibTestConfigurationBuilder, BibTestConfigurationBuilder)

                  Test "path/to/file.pdf" with "pdf" should be "file.pdf" with empty citation key FAILED

                  org.opentest4j.AssertionFailedError: expected: <file.pdf> but was: <path/to/file.pdf>
                      at app/org.jabref.jablib/org.jabref.logic.externalfiles.LinkedFileHandlerTest.getSuggestedFileNameWithMissingKey(LinkedFileHandlerTest.java:116)


                  getSuggestedFileName(String, String, String)

                    Test "path/to/other.pdf" with "pdf" should be "other.pdf" with empty citation key FAILED

                    org.opentest4j.AssertionFailedError: expected: <other.pdf> but was: <path/to/other.pdf>
                        at app/org.jabref.jablib/org.jabref.logic.externalfiles.LinkedFileHandlerTest.getSuggestedFileNameWithMissingKey(LinkedFileHandlerTest.java:116)


    BibtexParserTest

      CitaviXmlImporterFilesTest

        FileUtilTest

          checkFileExtensionAreTheSameForStringsAndPaths(String)

            Test [2] "te.st.PdF  " FAILED

            java.nio.file.InvalidPathException: Trailing char < > at index 10: te.st.PdF
                at org.jabref.jablib/org.jabref.logic.util.io.FileUtilTest.checkFileExtensionAreTheSameForStringsAndPaths(FileUtilTest.java:255)

I think these are actually test errors, as in the test assumes not windows so it fails, but the functionality is correct. These were both tests I changed, so I will make sure they're correct and open a new PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feature request: book front cover feature

7 participants