Skip to content

fix(jira): link tickets by their public address - #6757

Open
purisev wants to merge 2 commits into
keephq:mainfrom
purisev:fix/jira-ticket-url-public-host
Open

fix(jira): link tickets by their public address#6757
purisev wants to merge 2 commits into
keephq:mainfrom
purisev:fix/jira-ticket-url-public-host

Conversation

@purisev

@purisev purisev commented Sep 3, 2026

Copy link
Copy Markdown

Problem

See #6752. ticket_creation_url is declared in the authentication config of both
providers and read by neither, and ticket_url always comes from the host the
provider connects to. Where those differ, the link Keep returns opens for nobody
outside.

Fix

A browse_host property, identical in both providers, resolves the base for the
links. It reads ticket_creation_url, adds https when the value carries no
scheme, and drops a trailing .jspa page along with the /secure/ segment
holding it, so a create-form link in any of its shapes reduces to the site base.
Query and fragment go too, so ?pid=10000&issuetype=1 does not travel into the
ticket link. A value naming no host falls back to the connection host, which at
least produces a link that opens, and so does an empty field. Both the create and
the update path in _notify build ticket_url from the property.

An installation that leaves the field empty sees no change.

Tests

tests/test_jira_provider.py grows to 30 tests, all passing. A table of 13 URL
shapes runs against both providers: create-form links with and without a context
path, CreateIssue!default.jspa, a ?pid= query, a bare host, a host with a
port, trailing slashes, mixed case. Separate tests cover the fallbacks (empty,
whitespace, a value with no host, a bare path) and check that the ticket_url
returned by _notify uses the public host on both providers.

Docs

Both provider pages get a "Public ticket links" section listing the shapes the
field accepts, the config field's description says it doubles as the public base
for returned links, and the autogenerated snippets are regenerated.

Note on the other Jira PRs

#6755, #6756 and the JQL one cover the other three reports on these providers.
This PR shares only tests/test_jira_provider.py with them, where the blocks are
added side by side.

Fixes #6752

ticket_url was always built from the host the provider connects to. When that
host is internal - a cluster address, a proxy shim - every link Keep hands back
is one nobody can open.

Both providers already declare ticket_creation_url and never read it. Read it
now: the public new-issue link gives the public base, and the connection host
stays the fallback, so nothing changes for anyone who leaves the field empty.

The link is parsed as a url rather than matched against one spelling of it,
because Jira hands out the create form in several: CreateIssue.jspa,
CreateIssue!default.jspa, either of them behind a context path and carrying a
?pid= query. A plain base url works too, with or without a scheme. A value that
names no host at all keeps the links on the connection host instead of building
a broken one.

Signed-off-by: Iurii Purisev <92510590+purisev@users.noreply.github.com>
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.

[🐛 Bug]: Jira providers ignore ticket_creation_url and link tickets by the connection host

1 participant