Auto file name truncation if path length exceeding limit while renaming on Windows#15488
Open
xIshanSandhux wants to merge 10 commits intoJabRef:mainfrom
Open
Auto file name truncation if path length exceeding limit while renaming on Windows#15488xIshanSandhux wants to merge 10 commits intoJabRef:mainfrom
xIshanSandhux wants to merge 10 commits intoJabRef:mainfrom
Conversation
2 tasks
calixtus
reviewed
Apr 5, 2026
calixtus
reviewed
Apr 5, 2026
calixtus
reviewed
Apr 5, 2026
calixtus
reviewed
Apr 5, 2026
calixtus
reviewed
Apr 5, 2026
calixtus
reviewed
Apr 5, 2026
calixtus
reviewed
Apr 5, 2026
calixtus
reviewed
Apr 5, 2026
calixtus
reviewed
Apr 5, 2026
calixtus
reviewed
Apr 5, 2026
calixtus
reviewed
Apr 5, 2026
calixtus
reviewed
Apr 5, 2026
calixtus
reviewed
Apr 5, 2026
calixtus
reviewed
Apr 5, 2026
calixtus
reviewed
Apr 5, 2026
9d06b2a to
1843b7e
Compare
calixtus
reviewed
Apr 6, 2026
xIshanSandhux
commented
Apr 10, 2026
Contributor
Author
xIshanSandhux
left a comment
There was a problem hiding this comment.
Currently looking into why the test check is failing and fixing it. However do lmk if I need to make any other changes
Collaborator
|
JUnit tests of You can then run these tests in IntelliJ to reproduce the failing tests locally. We offer a quick test running howto in the section Final build system checks in our setup guide. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related issues and pull requests
Closes #14771
PR Description
This PR is a bug fix which occurs on Windows. The bug occurs when the user tries to rename the file via the defined pattern option and if the title is very long Jabref does not truncate the title, and instead displays "JabRef cannot access the file because it is being used by another process." which is not the correct representation of the error that occurred.
As this bug occurred on windows and the issue had the label "platform: windows", the fix is only for windows and not for any other OS.
the function renameToName in LinkedFileHandler.java was throwing an IOException when calling Files.move().This was happening only when the newPath length was greater than the allowed limit (260 chars) on windows. The error was handled by performRenameWithConflictCheck() in LinkedFileViewModel.java which contains the base error that was being displayed to the user.
Fix in this PR
I tested the fix with different file formats and its working as intended. Attached a few of them below.
Note: The allowed limit is 260 as the Max path length. However that also includes
\0therefore, the actual allowed limit for the path is 259. Which is why I used the 259 as the max const and not 260.Also I have added a bit of debug statements as well. which was just for my own understanding, in order to find the bug. I can remove them if you guys want.
Also, there were some formatting changes that were happening automatically when saving the files (I am currently using intellij to edit the files). I will fix that.
Steps to test
I used the following entry:
@Article{Diringer2012, author = {Diringer, Yvan}, journal = {Lépidoptères - Revue des Lépidoptéristes de France}, pages = {56--63}, title = {Chronique d’élevage 4: l’élevage de l’{Azuré} de l’{Orobe}, {Polyommatus} ({Meleageria}) daphnis ({Denis} \& {Scuiffermuller}, 1775) notes complémentaires sur l’hybride cormion ({Nabokov}, 1941): {P.} ({L.}) coridon x {P.} ({M.}) daphnis ({Lepidoptera}: {Lycaenidae}}, volume = {21}, year = {2012}, number = {52}, file = {}, groups = {Polyommatus,Lysandra}, }Snapshots of the Fix
File Renaming (truncation)
Error Handling
screenshot showing a library with a single entry with me as author and as title the issue number (asked in the checklist):
Not sure if i need to add tests for this change.
Checklist
CHANGELOG.mdin a way that can be understood by the average user (if change is visible to the user)