Skip to content

fix: preview Jira issues whose project key contains digits - #241

Merged
oleksandr-nc merged 1 commit into
mainfrom
fix/issue-keys-with-digits
Oct 23, 2026
Merged

oleksandr-nc merged 1 commit into
mainfrom
fix/issue-keys-with-digits

Conversation

@oleksandr-nc

Copy link
Copy Markdown
Contributor

Fixes #236

Project keys with digits got a generic link card

Jira Cloud project keys are a letter followed by letters or digits, such as AB12C. The link preview recognised only keys made of letters, so the app turned down a link like https://example.atlassian.net/browse/AB12C-345, and apps such as Whiteboard and Talk showed it as a generic link card. A project key is now a letter followed by one or more letters, digits or underscores, in any case. The link has to start with the issue page, and it can go on with a path, a query, a fragment or the punctuation of the sentence it ends.

A link is looked up on the site it points to

The preview looked the key up on the user's own Jira whatever host the link named, so a link to another company's site showed the user's own issue with the same key. With OAuth it asked the authorised sites in turn and stopped at the first one without that issue, so the preview only worked when every site had an issue with that key, and then showed the last site's one. The preview is now offered only for a site the user is connected to, and the issue is asked from that site alone. For an API token or a login and password, that is the host the user connected to or the host of the base URL kept from Jira; for OAuth, one of the authorised sites. Deciding this takes no request to Jira.

Connecting asks Jira for its base URL

Connecting with an API token or a login and password now also asks Jira for the base URL it builds its links with (rest/api/2/serverInfo), and keeps it in place of any kept before. A connection through Atlassian's API gateway (https://api.atlassian.com/ex/jira/…) needs it to recognise its own site's links, so a gateway connection made before this change shows its link previews again once it is connected again. When Jira gives no usable answer, only the host the user connected to counts until a base URL is known, as the avatars still ask for it too.

An issue that cannot be shown falls back without warnings

An issue the preview could not show, such as one the user cannot see, reached the generic link card only after two PHP warnings and a type error, and the warnings went to the log. It now falls back directly.

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI

Jira Cloud project keys are a letter followed by letters or digits,
but the link preview only recognised keys made of letters, so a link
such as https://example.atlassian.net/browse/AB12C-345 got a generic
link card.

The preview now also looks an issue up on the site the link points to,
and only when the user is connected to that site: for an API token or
a login and password, the host the user connected to or the host of
the base URL kept from Jira; for OAuth, one of the authorised sites.
It used to look the key up on the user's own Jira whatever the link's
host, so a link to another company's site showed the user's own issue
with the same key, and a user who authorised several sites with OAuth
got the generic link card unless every site had an issue with that
key, and then saw the last site's one.

Connecting with an API token or a login and password now asks Jira for
its base URL, which names the site when the connection goes through
Atlassian's API gateway, and keeps it in place of any kept before. A
gateway connection made before this change shows its link previews
again once it is connected again.

An issue that cannot be shown, such as one the user cannot see, now
gets the generic link card without two PHP warnings in the log.

Fixes #236

Signed-off-by: Oleksander Piskun <oleksandr2088@icloud.com>
@oleksandr-nc
oleksandr-nc merged commit 03dc5a1 into main Oct 23, 2026
24 checks passed
@oleksandr-nc
oleksandr-nc deleted the fix/issue-keys-with-digits branch October 23, 2026 06:20
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.

Link preview in Whiteboard not working for Jira project keys containing digits

1 participant