@@ -723,7 +723,16 @@ func UpdatePullRequest(ctx *context.Context) {
723723 if err = pull_service .Update (issue .PullRequest , ctx .User , message ); err != nil {
724724 if models .IsErrMergeConflicts (err ) {
725725 conflictError := err .(models.ErrMergeConflicts )
726- ctx .Flash .Error (ctx .Tr ("repo.pulls.merge_conflict" , utils .SanitizeFlashErrorString (conflictError .StdErr ), utils .SanitizeFlashErrorString (conflictError .StdOut )))
726+ flashError , err := ctx .HTMLString (string (tplAlertDetails ), map [string ]interface {}{
727+ "Message" : ctx .Tr ("repo.pulls.merge_conflict" ),
728+ "Summary" : ctx .Tr ("repo.pulls.merge_conflict_summary" ),
729+ "Details" : utils .SanitizeFlashErrorString (conflictError .StdErr ) + "<br>" + utils .SanitizeFlashErrorString (conflictError .StdOut ),
730+ })
731+ if err != nil {
732+ ctx .ServerError ("UpdatePullRequest.HTMLString" , err )
733+ return
734+ }
735+ ctx .Flash .Error (flashError )
727736 ctx .Redirect (ctx .Repo .RepoLink + "/pulls/" + com .ToStr (issue .Index ))
728737 return
729738 }
@@ -846,12 +855,30 @@ func MergePullRequest(ctx *context.Context, form auth.MergePullRequestForm) {
846855 return
847856 } else if models .IsErrMergeConflicts (err ) {
848857 conflictError := err .(models.ErrMergeConflicts )
849- ctx .Flash .Error (ctx .Tr ("repo.pulls.merge_conflict" , utils .SanitizeFlashErrorString (conflictError .StdErr ), utils .SanitizeFlashErrorString (conflictError .StdOut )))
858+ flashError , err := ctx .HTMLString (string (tplAlertDetails ), map [string ]interface {}{
859+ "Message" : ctx .Tr ("repo.editor.merge_conflict" ),
860+ "Summary" : ctx .Tr ("repo.editor.merge_conflict_summary" ),
861+ "Details" : utils .SanitizeFlashErrorString (conflictError .StdErr ) + "<br>" + utils .SanitizeFlashErrorString (conflictError .StdOut ),
862+ })
863+ if err != nil {
864+ ctx .ServerError ("MergePullRequest.HTMLString" , err )
865+ return
866+ }
867+ ctx .Flash .Error (flashError )
850868 ctx .Redirect (ctx .Repo .RepoLink + "/pulls/" + com .ToStr (pr .Index ))
851869 return
852870 } else if models .IsErrRebaseConflicts (err ) {
853871 conflictError := err .(models.ErrRebaseConflicts )
854- ctx .Flash .Error (ctx .Tr ("repo.pulls.rebase_conflict" , utils .SanitizeFlashErrorString (conflictError .CommitSHA ), utils .SanitizeFlashErrorString (conflictError .StdErr ), utils .SanitizeFlashErrorString (conflictError .StdOut )))
872+ flashError , err := ctx .HTMLString (string (tplAlertDetails ), map [string ]interface {}{
873+ "Message" : ctx .Tr ("repo.editor.rebase_conflict" , utils .SanitizeFlashErrorString (conflictError .CommitSHA )),
874+ "Summary" : ctx .Tr ("repo.editor.rebase_conflict_summary" ),
875+ "Details" : utils .SanitizeFlashErrorString (conflictError .StdErr ) + "<br>" + utils .SanitizeFlashErrorString (conflictError .StdOut ),
876+ })
877+ if err != nil {
878+ ctx .ServerError ("MergePullRequest.HTMLString" , err )
879+ return
880+ }
881+ ctx .Flash .Error (flashError )
855882 ctx .Redirect (ctx .Repo .RepoLink + "/pulls/" + com .ToStr (pr .Index ))
856883 return
857884 } else if models .IsErrMergeUnrelatedHistories (err ) {
@@ -871,7 +898,16 @@ func MergePullRequest(ctx *context.Context, form auth.MergePullRequestForm) {
871898 if len (message ) == 0 {
872899 ctx .Flash .Error (ctx .Tr ("repo.pulls.push_rejected_no_message" ))
873900 } else {
874- ctx .Flash .Error (ctx .Tr ("repo.pulls.push_rejected" , utils .SanitizeFlashErrorString (pushrejErr .Message )))
901+ flashError , err := ctx .HTMLString (string (tplAlertDetails ), map [string ]interface {}{
902+ "Message" : ctx .Tr ("repo.pulls.push_rejected" ),
903+ "Summary" : ctx .Tr ("repo.pulls.push_rejected_summary" ),
904+ "Details" : utils .SanitizeFlashErrorString (pushrejErr .Message ),
905+ })
906+ if err != nil {
907+ ctx .ServerError ("MergePullRequest.HTMLString" , err )
908+ return
909+ }
910+ ctx .Flash .Error (flashError )
875911 }
876912 ctx .Redirect (ctx .Repo .RepoLink + "/pulls/" + com .ToStr (pr .Index ))
877913 return
@@ -986,7 +1022,16 @@ func CompareAndPullRequestPost(ctx *context.Context, form auth.CreateIssueForm)
9861022 if len (message ) == 0 {
9871023 ctx .Flash .Error (ctx .Tr ("repo.pulls.push_rejected_no_message" ))
9881024 } else {
989- ctx .Flash .Error (ctx .Tr ("repo.pulls.push_rejected" , utils .SanitizeFlashErrorString (pushrejErr .Message )))
1025+ flashError , err := ctx .HTMLString (string (tplAlertDetails ), map [string ]interface {}{
1026+ "Message" : ctx .Tr ("repo.pulls.push_rejected" ),
1027+ "Summary" : ctx .Tr ("repo.pulls.push_rejected_summary" ),
1028+ "Details" : utils .SanitizeFlashErrorString (pushrejErr .Message ),
1029+ })
1030+ if err != nil {
1031+ ctx .ServerError ("CompareAndPullRequest.HTMLString" , err )
1032+ return
1033+ }
1034+ ctx .Flash .Error (flashError )
9901035 }
9911036 ctx .Redirect (ctx .Repo .RepoLink + "/pulls/" + com .ToStr (pullIssue .Index ))
9921037 return
0 commit comments