Skip to content

Fix directory path validation checks#13029

Merged
koppor merged 12 commits into
JabRef:mainfrom
paudelritij:fix-for-issue-13017
May 2, 2025
Merged

Fix directory path validation checks#13029
koppor merged 12 commits into
JabRef:mainfrom
paudelritij:fix-for-issue-13017

Conversation

@paudelritij

Copy link
Copy Markdown
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
Copy Markdown
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

koppor commented May 1, 2025

Copy link
Copy Markdown
Member

@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

@koppor koppor 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.

Small typos in the code.

Need to try out later.

@koppor

koppor commented May 2, 2025

Copy link
Copy Markdown
Member

Tried it out - works.

Comment thread jablib/src/main/resources/l10n/JabRef_en.properties Outdated
@koppor koppor enabled auto-merge May 2, 2025 12:06
@trag-bot

trag-bot Bot commented May 2, 2025

Copy link
Copy Markdown

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

1 similar comment
@trag-bot

trag-bot Bot commented May 2, 2025

Copy link
Copy Markdown

@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