Skip to content

If user moved file, it should simply be relinked - [Find Unlinked Files part] #9798

@koppor

Description

@koppor

A user might move files in the file directory without JabRef.

Then, JabRef does not find the file:

Image

But it still exists.

Example:

  1. Open `test-support\src\manual-tests\issue-9798\issue-9798.bib in JabRef
  2. Start "Lookup" -> "Find unlinked files"
    Image
  3. Now, it finds "minimal.pdf"
    Image

Current behavior: Blank right of minimal.pdf - and it would be re-imported

Expected result:

File should be relinked - and following shown in the status bar

file relinked to entry "minimal"


Alternative explanation:

Start:

@misc{test,
  file = {a.pdf}
}

File a.pdf exists

User moves a.pdf into folder-a.

When "Find unlinked files" is started, JabRef should

  • Recognize that a.pdf of test is missing
  • folder-a/a.pdf does not belong to any entry
  • Rewrite the link of test from a.pdf to folder-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.

image

Current output:

image

Follow-up implementation (NOT IN SCOPE OF THIS ISSUE)

(The following text is only a reminder of the development team to open a new issue)

The "Search for unlinked files" (Lookup -> Find unlinked files) dialog should get two columns as search result. Currently 1.

  • column 1: file x@folder y (as it is currently; with checkmarks)
  • column 2: candidate entry (citation key. If clicked, main table jumps to that entry)

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.

image


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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    Free to take

    Status

    Free to take

    Status

    Low priority

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions