mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-28 04:02:48 +00:00
fix(issue): prevent redirect to external tracker when built-in tracker is enabled (#39997)
PR #39354 added support for enabling both internal and external trackers concurrently and introduced separate navigation buttons. However, as originally pointed out during code review on #39354 ([comment](https://github.com/go-gitea/gitea/pull/39354#discussion_r4047774417)): > *"With both trackers enabled and the built-in issue unit readable, this redirect still runs whenever the external URL is nonempty, so `/issues` never reaches the internal issue list in the new combined configuration. Only redirect to the external tracker when the caller cannot read the internal issue unit."* `MustEnableIssues` in `routers/web/repo/issue.go` was still unconditionally redirecting whenever `unit.TypeExternalTracker` is enabled with a non-empty `ExternalTrackerURL`. ### Fix In `routers/web/repo/issue.go`, only redirect to the external tracker URL when the caller cannot read the built-in issue unit (`!ctx.Repo.Permission.CanRead(unit.TypeIssues)`). Signed-off-by: Vavrinecz Péter <98645804+petervavrinecz@users.noreply.github.com>
This commit is contained in:
1 parent
879ebfb3d8
commit
a397e92c80
1 file changed
+1
-1
@@ -101,7 +101,7 @@ func MustEnableIssues(ctx *context.Context) {
|
||||
unitExtTracker, err := ctx.Repo.Repository.GetUnit(ctx, unit.TypeExternalTracker)
|
||||
if err == nil {
|
||||
extURL := unitExtTracker.ExternalTrackerConfig().ExternalTrackerURL
|
||||
if extURL != "" {
|
||||
if extURL != "" && !ctx.Repo.Permission.CanRead(unit.TypeIssues) {
|
||||
ctx.Redirect(extURL)
|
||||
return
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user