-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Fix issue: Auto-linking files with safe character replacements #9267 #9316
Fix issue: Auto-linking files with safe character replacements #9267 #9316
Conversation
…linking_files_with_safe_character_replacements
…linking_files_with_safe_character_replacements
@@ -65,8 +65,13 @@ public List<Path> findAssociatedFiles(BibEntry entry, List<Path> directories, Li | |||
return result.stream().sorted().collect(Collectors.toList()); | |||
} | |||
|
|||
public static String getSafeCiteKey(String citeKey) { | |||
// replace the unsafe character with the underscore. | |||
return citeKey.replaceAll("[:/*?<>|]", "_"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should use the method FileNameCleaner.cleanFileName because this method is also called when the Filename is built from the citation key (when you have rename to pattern)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! I changed the citation key filter to FileNameCleaner!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, lgtm!
Thank you for the pull request. In future, please use the GitHub syntax Fixes #9304. Otherwise, GitHub does not automatically close the linked issue. |
TODO: That looks good so far, but I am unsure atm if it is also necessary to have this for exact matches |
|
Sorry for forgetting to fix the code style and I just now fixed it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
Thanks again for your PR! |
…ok-info.com-JabRef#9145 * upstream/main: New Crowdin updates (JabRef#9333) Refresh example styles Squashed 'buildres/csl/csl-styles/' changes from 4eee79a..13fd98e Bump unirest-java from 3.13.11 to 3.13.12 (JabRef#9330) Bump checkstyle from 10.3.4 to 10.4 (JabRef#9331) Bump gittools/actions from 0.9.14 to 0.9.15 (JabRef#9332) Group context menu presents relevant options depending on number of subgroups (JabRef#9286) Removed BibTeX file type and included HTML and Markdown types (JabRef#9318) Fix issue: Auto-linking files with safe character replacements JabRef#9267 (JabRef#9316) Fix for issue 8806: Button highlights doesn't respect rounded corners (JabRef#9320) New Crowdin updates (JabRef#9324) Update CHANGELOG.md Try to relocate listener binding (JabRef#9238) Changed the messages after importing unlinked local files to past passive tense. (JabRef#9308) Changed the color of found text from red to high contrast (JabRef#9315) # Conflicts: # CHANGELOG.md
* upstream/main: (30 commits) New translations JabRef_en.properties (German) (JabRef#9336) Fix Abbreviation for Escaped Ampersand (JabRef#9288) Fix font size preference not updating in preference dialog 8386 (JabRef#9287) New Crowdin updates (JabRef#9333) Refresh example styles Squashed 'buildres/csl/csl-styles/' changes from 4eee79a..13fd98e Bump unirest-java from 3.13.11 to 3.13.12 (JabRef#9330) Bump checkstyle from 10.3.4 to 10.4 (JabRef#9331) Bump gittools/actions from 0.9.14 to 0.9.15 (JabRef#9332) Group context menu presents relevant options depending on number of subgroups (JabRef#9286) Removed BibTeX file type and included HTML and Markdown types (JabRef#9318) Fix issue: Auto-linking files with safe character replacements JabRef#9267 (JabRef#9316) Fix for issue 8806: Button highlights doesn't respect rounded corners (JabRef#9320) New Crowdin updates (JabRef#9324) Update CHANGELOG.md Try to relocate listener binding (JabRef#9238) Changed the messages after importing unlinked local files to past passive tense. (JabRef#9308) Changed the color of found text from red to high contrast (JabRef#9315) New Crowdin updates (JabRef#9317) Add skips for MacOS X build (JabRef#9305) ...
* upstream/main: New Crowdin updates (#9333) Refresh example styles Squashed 'buildres/csl/csl-styles/' changes from 4eee79a..13fd98e Bump unirest-java from 3.13.11 to 3.13.12 (#9330) Bump checkstyle from 10.3.4 to 10.4 (#9331) Bump gittools/actions from 0.9.14 to 0.9.15 (#9332) Group context menu presents relevant options depending on number of subgroups (#9286) Removed BibTeX file type and included HTML and Markdown types (#9318) Fix issue: Auto-linking files with safe character replacements #9267 (#9316) Fix for issue 8806: Button highlights doesn't respect rounded corners (#9320) New Crowdin updates (#9324) Update CHANGELOG.md Try to relocate listener binding (#9238) Changed the messages after importing unlinked local files to past passive tense. (#9308) Changed the color of found text from red to high contrast (#9315) New Crowdin updates (#9317) Add skips for MacOS X build (#9305) New Crowdin updates (#9248) Fix for issue 9304 (#9313) # Conflicts: # CHANGELOG.md
Fixes #9267
Short Description
This aims to fix the issue where it is impossible to find the related file when the citation key involves some characters (e.g.
:
) that cannot be contained in the file name.We fix this issue by searching the related file with the citation key where its unsafe characters are replaced with underscores
_
. (See #9267)UI changes
Note: The user should reopen the library to see the attachment
CHANGELOG.md
described in a way that is understandable for the average user (if applicable)