Skip to content

Fix directory path validation checks #13029

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

Merged
merged 12 commits into from
May 2, 2025

Conversation

paudelritij
Copy link
Contributor

Closes #13017
Follow-up to #12867

1.validateDirectory() method was not handling relative path correctly.
2. While assigning 'valid relative path' then pressing folder icon, getBrowseDirectory() method was not checking the 'valid provided directory path' properly.

Fix: paths now will be resolve against library working directory.

Mandatory checks

  • I own the copyright of the code submitted and I license it under the MIT license
  • Change in CHANGELOG.md described in a way that is understandable for the average user (if change is visible to the user)
  • [/] Tests created for changes (if applicable)
  • Manually tested changed features in running JabRef (always required)
  • [/] Screenshots added in PR description (if change is visible to the user)
  • Checked developer's documentation: Is the information available and up to date? If not, I outlined it in this pull request.
  • Checked documentation: Is the information available and up to date? If not, I created an issue at https://github.com/JabRef/user-documentation/issues or, even better, I submitted a pull request to the documentation repository.

@paudelritij paudelritij marked this pull request as ready for review April 29, 2025 06:03
@paudelritij paudelritij requested a review from koppor April 30, 2025 02:44
@paudelritij
Copy link
Contributor Author

@koppor I found I had not added proper validation message for unsaved library while working on #11840. Shall I add it to current PR (msg like 'Save the library to perform this action') since few lines of code ? or need new PR if we want to disable the field with dir icon since lib not saved.

@koppor
Copy link
Member

koppor commented May 1, 2025

@koppor I found I had not added proper validation message for unsaved library while working on #11840.

Oh, this is unfortunate.

I think, I commented. But I have no time to search.

If libPath is empty, use configDir. No need for an error message. Only making the configDir path relative to the bib path won't work.

Maybe, we need a UML state chart to visualize. I remember, I commented somehow about the global setting to store PDFs relative to the bib file, but I don't know if in the context of this.

Shall I add it to current PR (msg like 'Save the library to perform this action') since few lines of code ? or need new PR if we want to disable the field with dir icon since lib not saved.

Both is wrong IMHO. Absolute paths always work.

@paudelritij paudelritij requested a review from koppor May 2, 2025 08:51
Copy link
Member

@koppor koppor left a comment

Choose a reason for hiding this comment

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

Small typos in the code.

Need to try out later.

@koppor
Copy link
Member

koppor commented May 2, 2025

Tried it out - works.

@koppor koppor enabled auto-merge May 2, 2025 12:06
Copy link

trag-bot bot commented May 2, 2025

@trag-bot didn't find any issues in the code! ✅✨

1 similar comment
Copy link

trag-bot bot commented May 2, 2025

@trag-bot didn't find any issues in the code! ✅✨

@koppor koppor added this pull request to the merge queue May 2, 2025
Merged via the queue into JabRef:main with commit 869e80e May 2, 2025
1 check passed
Siedlerchr added a commit that referenced this pull request May 2, 2025
* upstream/main:
  Fix directory path validation checks (#13029)
  Keep merge=union for JabRef_en.properties
  Merging Entry Creation Buttons Into a Single Tool (#13020)
  refine-jabsrv (#13044)
  Switch if branches for readbility (#13042)
  Updating the gradle wrapper does not need any JDK (#13037)
  Fix path - and fix typo (#13038)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Directory check should respect relative paths
2 participants