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

Path should be relative after import at "Find Unlinked Files" #549

Closed
koppor opened this issue Dec 23, 2021 · 13 comments · Fixed by JabRef/jabref#12088
Closed

Path should be relative after import at "Find Unlinked Files" #549

koppor opened this issue Dec 23, 2021 · 13 comments · Fixed by JabRef/jabref#12088

Comments

@koppor
Copy link
Member

koppor commented Dec 23, 2021

(Update)

As user I might a directory of files, for which there is no repesentation in my local library. I can use "Search for unlinked local files"

grafik

A documentation is available at https://docs.jabref.org/collect/findunlinkedfiles#link-the-pdfs-to-your-bib-library

When I run the tool and import entries, the full absolute path is written:

    file      = {:C\:/Users/koppor/git-repositories/paper/bib/pdfs/Adapting BDDs for Visualizing Product Configuration Data.pdf:PDF},

expected:

    file      = {:Adapting BDDs for Visualizing Product Configuration Data.pdf:PDF},

because of

    @Comment{jabref-meta: fileDirectory:pdfs;}

The .bib file is located in C\:/Users/koppor/git-repositories/paper/bib. Therefore, the configuration of the path pdf works.

How to reproduce

  1. Put test PDF files in c:\jabref-test\pdfs
  2. Create test.bib in c:\jabref-test
  3. Configure c:\jabref-test\pdfs as PDF path int he library:
    grafik
  4. Execute the "Search for unlinked local files"

Implementation Hints

The functionality to call is the same as in the cleanup entries dialog

grafik

@Racheal7
Copy link

Hi Oliver, can I please take this issue? I just started to learn Java and would like to get more practical experience. Thank you~

@u7232539
Copy link

u7232539 commented Oct 27, 2022

Hi there, I managed to change the path to a relative path.

I think the method getFileDirectories is not returning the path of the file, that's why the method relativize isn't working.
The fix is to add the file path, so it can be relativized.

Before:
The file path is an absolute path.
image

After:
The file path is a relative path.
image

Also, I found 2 more issues.

  1. In the cleanup entries, the default of Make paths of linked files relative (if possible) is ticked. But it does not show the relative path by default. In order to show the relative path, users need to press the OK button in the cleanup entries.

  2. Relative path cannot revert back to the absolute path. After unchecking the checkbox Make paths of linked files relative (if possible) , the path is still a relative path.

@koppor
Copy link
Member Author

koppor commented Oct 27, 2022

Hi there, I managed to change the path to a relative path.

Just as a double check: Did you really use the funtionality "Search for unlinked files"

grafik

I refined the issue description accordingly. - I am sorry if it was non-understandable before (therefore, I also put the label "issue-understanding")

I think the method getFileDirectories is not returning the path of the file, that's why the method relativize isn't working. The fix is to add the file path, so it can be relativized.

What did you configure as PDF directory in your .bib file? I put the section "How to reproduce" above to show exact steps.

Before: The file path is an absolute path. image

After: The file path is a relative path. image

Also, I found 2 more issues.

1. In the cleanup entries, the default of `Make paths of linked files relative (if possible)` is ticked. But it does not show the relative path by default. 

What do you mean by "show"?

In order to show the relative path, users need to press the OK button in the cleanup entries.

(Context: https://docs.jabref.org/finding-sorting-and-cleaning-entries/cleanupentries)

This is the intended action of the dialog. As first action, you could rename "OK" to "Apply". This should be more intuitive.

It would be great if the cleanup dialog could have a "preview" of the things to be done. However, I think, this is difficult, because all actions need to be reverted when pressing "Cancel".

2. Relative path cannot revert back to the absolute path. After unchecking the checkbox  `Make paths of linked files relative (if possible)` , the path is still a relative path.

Yes, there is no cleanup action for that. This is intended as we think, relative paths are better.

@u7232539
Copy link

I am sorry that I did not understand this issue correctly and did not use the functionality "Search for unlinked files" to reproduce this issue.

Now I have configured this in my .bib file, applied "Search for unlinked files" and imported 1 pdf file. from C:/Downloads/
image

This is what I got after the import at "Find Unlinked files".
file = {:C\:/Downloads/started2021 - V.pdf:PDF}

One thing I am not sure about is the location of the file. Should it be its original location (C:/Downloads/...) or under the C:\jabref_test\pdfs?

This is the intended action of the dialog. As first action, you could rename "OK" to "Apply". This should be more intuitive.
It would be great if the cleanup dialog could have a "preview" of the things to be done. However, I think, this is difficult, because all actions need to be reverted when pressing "Cancel".

Yes, you are right.

Yes, there is no cleanup action for that. This is intended as we think, relative paths are better.

Then perhaps users should be alerted that this is an irreversible action?

@koppor
Copy link
Member Author

koppor commented Oct 28, 2022

In your example, the path CANNOT be relativzed, because JabRef only uses the sub directory of the path in "General file directory"

The paths marked in yellow are neither the same nor is the downloads directory a sub path of the general file directory.

grafik

Thus, you can try to configure "C:\Downloads" as General file directory adn then re-run your experiment.

@IceMajor2
Copy link

Hello. Could I get assigned to work on this issue?

@koppor koppor moved this from Free to take to Reserved in Good First Issues Oct 23, 2023
@koppor koppor assigned u7232539 and IceMajor2 and unassigned u7232539 Oct 23, 2023
@koppor
Copy link
Member Author

koppor commented Oct 23, 2023

@IceMajor2 Sure - the discussion should give you enough context, doesn't it?

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.

@u7676493
Copy link

u7676493 commented Oct 10, 2024

Hello, I am here to do a university assignment where I attempt to solve issues in open source projects! I would like to work on this issue, and am wondering if it is still available to do.

@koppor
Copy link
Member Author

koppor commented Oct 16, 2024

@u7676493 Sure! Go ahead. Sorry for the delay.

@koppor
Copy link
Member Author

koppor commented Oct 16, 2024

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

@u7676493
Copy link

/assign-me

Copy link

👋 Hey @u7676493, 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 30 days (by 19 November 2024). A maintainer can also add the "📌 Pinned"" label to prevent automatic unassignment.

@koppor
Copy link
Member Author

koppor commented Nov 10, 2024

Closed via JabRef#12088

@koppor koppor closed this as completed Nov 10, 2024
@github-project-automation github-project-automation bot moved this from Assigned to Done in Good First Issues Nov 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment