marc0l92 / obsidian-jira-issue

This plugin allows you to track the progress of Atlassian Jira issues from your Obsidian notes.
https://marc0l92.github.io/obsidian-jira-issue/
GNU Affero General Public License v3.0
225 stars 35 forks source link

Issue with underscores in project names #50

Closed Barbaribouch closed 1 year ago

Barbaribouch commented 1 year ago

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

marc0l92 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

Hahaha, I really need to work on my unit tests