@@ -1322,29 +1322,16 @@ func DownloadPullPatch(ctx *context.Context) {
1322
1322
1323
1323
// DownloadPullDiffOrPatch render a pull's raw diff or patch
1324
1324
func DownloadPullDiffOrPatch (ctx * context.Context , patch bool ) {
1325
- issue , err := models .GetIssueByIndex (ctx .Repo .Repository .ID , ctx .ParamsInt64 (":index" ))
1325
+ pr , err := models .GetPullRequestByIndex (ctx .Repo .Repository .ID , ctx .ParamsInt64 (":index" ))
1326
1326
if err != nil {
1327
- if models .IsErrIssueNotExist (err ) {
1328
- ctx .NotFound ("GetIssueByIndex " , err )
1327
+ if models .IsErrPullRequestNotExist (err ) {
1328
+ ctx .NotFound ("GetPullRequestByIndex " , err )
1329
1329
} else {
1330
- ctx .ServerError ("GetIssueByIndex " , err )
1330
+ ctx .ServerError ("GetPullRequestByIndex " , err )
1331
1331
}
1332
1332
return
1333
1333
}
1334
1334
1335
- // Return not found if it's not a pull request
1336
- if ! issue .IsPull {
1337
- ctx .NotFound ("DownloadPullDiff" ,
1338
- fmt .Errorf ("Issue is not a pull request" ))
1339
- return
1340
- }
1341
-
1342
- if err = issue .LoadPullRequest (); err != nil {
1343
- ctx .ServerError ("LoadPullRequest" , err )
1344
- return
1345
- }
1346
-
1347
- pr := issue .PullRequest
1348
1335
binary := ctx .FormBool ("binary" )
1349
1336
1350
1337
if err := pull_service .DownloadDiffOrPatch (pr , ctx , patch , binary ); err != nil {
0 commit comments