Skip to content

"Copy Link" yields wrong URL in pull request #16102

Closed
@sotho

Description

@sotho

Description

In a pull request each comment has a link that can be used to reference the comment.
The link can be obtained by

  1. right clicking on the text "sotho commented 15 hours ago" -> Copy Link (from browser context menu), this gives e.g.:
    https://try.gitea.io/BracTest/piparallel/pulls/7#issuecomment-87880
  2. click on "..." -> "Copy Link" (from gitea context menu), this gives e.g.:
    https://try.gitea.io/BracTest/piparallel/issues/7#issuecomment-87880

If the internal issue tracker is enabled the second URL forwards to the first it seems.
If the internal issue tracker is disabled and forwarding to an external tracker, then the second URL does not work properly.

I would expect that both methods should yield the same URL.
For the second method the file templates/repo/issue/view_content/context_menu.tmpl builds the URL:

    {{ if .issue }}
        {{ $referenceUrl = Printf "%s%s/issues/%d#%s" AppUrl .ctx.Repository.FullName .ctx.Issue.Index .item.HashTag }}
    {{ else }}
        {{ $referenceUrl = Printf "%s%s/pulls/%d/files#%s" AppUrl .ctx.Repository.FullName .ctx.Issue.Index .item.HashTag }}
    {{ end }}

Changing "%s%s/issues/%d#%s" to "%s%s/pulls/%d#%s" fixes it for my use case, but might break the issue tracker?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions