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

Issue with underscores in project names #50

Closed
1 of 5 tasks
Barbaribouch opened this issue Dec 30, 2022 · 3 comments
Closed
1 of 5 tasks

Issue with underscores in project names #50

Barbaribouch opened this issue Dec 30, 2022 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@Barbaribouch
Copy link

Describe the bug
Both functionalities "Jira issue" and "Inline issue" don't work as soon as there is an underscore in the project name

To Reproduce
Try displaying a ticket in a project containing an underscore :

```jira-issue
PRJ_TEST-1
```

or

JIRA:PRJ_TEST-1

Expected behavior
Displaying the ticket correctly

Suggested solution
Replacing all (I found 5) [A-Z0-9]+-[0-9]+ occurences by [_A-Z0-9]+-[0-9]+ (or maybe a more refined solution to prevent project names from starting or ending with an underscore)

Plugin version and platform

  • Version: 1.48.0
  • Obsidian Windows
  • Obsidian Mac
  • Obsidian Linux
  • Obsidian Android
  • Obsidian iOS
@Barbaribouch Barbaribouch added the bug Something isn't working label Dec 30, 2022
@Barbaribouch Barbaribouch changed the title [Bug] Issue with underscores in project names Dec 30, 2022
@marc0l92
Copy link
Owner

marc0l92 commented Jan 11, 2023

Hello, I was not aware that projects key could contain an underscore.
The bug is fixed starting from version 1.50.0

Please let me know if it works fine

@Barbaribouch
Copy link
Author

Thank you, it almost works, but the two following lines in src/rendering/issueFenceRenderer.ts :

const ISSUE_REGEX = new RegExp(`^\s*(${JIRA_KEY_REGEX})\s*$`, 'i')
const ISSUE_LINK_REGEX = new RegExp(`\/(${JIRA_KEY_REGEX})\s*$`, 'i')

become

var ISSUE_REGEX = new RegExp(`^s*(${JIRA_KEY_REGEX})s*$`, "i");
var ISSUE_LINK_REGEX = new RegExp(`/(${JIRA_KEY_REGEX})s*$`, "i");

in main.js.

As a result, any project starting with a 's' is not recognized correctly.

@marc0l92
Copy link
Owner

Hahaha, I really need to work on my unit tests

marc0l92 pushed a commit that referenced this issue Jan 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

No branches or pull requests

2 participants