@@ -607,17 +607,20 @@ func commentTag(repo *models.Repository, poster *models.User, issue *models.Issu
607
607
608
608
// ViewIssue render issue view page
609
609
func ViewIssue (ctx * context.Context ) {
610
- extIssueUnit , err := ctx .Repo .Repository .GetUnit (models .UnitTypeExternalTracker )
611
- if err == nil && extIssueUnit != nil {
612
- if extIssueUnit .ExternalTrackerConfig ().ExternalTrackerStyle == markup .IssueNameStyleNumeric || extIssueUnit .ExternalTrackerConfig ().ExternalTrackerStyle == "" {
613
- metas := ctx .Repo .Repository .ComposeMetas ()
614
- metas ["index" ] = ctx .Params (":index" )
615
- ctx .Redirect (com .Expand (extIssueUnit .ExternalTrackerConfig ().ExternalTrackerFormat , metas ))
610
+ if ctx .Params (":type" ) == "issues" {
611
+ // If issue was requested we check if repo has external tracker and redirect
612
+ extIssueUnit , err := ctx .Repo .Repository .GetUnit (models .UnitTypeExternalTracker )
613
+ if err == nil && extIssueUnit != nil {
614
+ if extIssueUnit .ExternalTrackerConfig ().ExternalTrackerStyle == markup .IssueNameStyleNumeric || extIssueUnit .ExternalTrackerConfig ().ExternalTrackerStyle == "" {
615
+ metas := ctx .Repo .Repository .ComposeMetas ()
616
+ metas ["index" ] = ctx .Params (":index" )
617
+ ctx .Redirect (com .Expand (extIssueUnit .ExternalTrackerConfig ().ExternalTrackerFormat , metas ))
618
+ return
619
+ }
620
+ } else if err != nil && ! models .IsErrUnitTypeNotExist (err ) {
621
+ ctx .ServerError ("GetUnit" , err )
616
622
return
617
623
}
618
- } else if err != nil && ! models .IsErrUnitTypeNotExist (err ) {
619
- ctx .ServerError ("GetUnit" , err )
620
- return
621
624
}
622
625
623
626
issue , err := models .GetIssueByIndex (ctx .Repo .Repository .ID , ctx .ParamsInt64 (":index" ))
@@ -1255,7 +1258,7 @@ func NewComment(ctx *context.Context, form auth.CreateCommentForm) {
1255
1258
1256
1259
if ctx .HasError () {
1257
1260
ctx .Flash .Error (ctx .Data ["ErrorMsg" ].(string ))
1258
- ctx .Redirect (fmt . Sprintf ( "%s/issues/%d" , ctx . Repo . RepoLink , issue .Index ))
1261
+ ctx .Redirect (issue .HTMLURL ( ))
1259
1262
return
1260
1263
}
1261
1264
0 commit comments