diff options
author | Norwin <noerw@users.noreply.github.com> | 2021-09-27 23:09:49 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-27 17:09:49 -0400 |
commit | f48dce3176649916c262ab080d5f38a0433f38c0 (patch) | |
tree | d009bc163d78577666dc462d376d697f600ef2d1 /routers/api/v1 | |
parent | e8574f2f7d4648b5b3fda48f3e31599a6b9dd40b (diff) | |
download | gitea-f48dce3176649916c262ab080d5f38a0433f38c0.tar.gz gitea-f48dce3176649916c262ab080d5f38a0433f38c0.zip |
Don't return binary file changes in raw PR diffs by default (#17158)
* return diffs without binary file content change
* ?binary=true option to restore old behaviour
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: zeripath <art27@cantab.net>
Diffstat (limited to 'routers/api/v1')
-rw-r--r-- | routers/api/v1/repo/pull.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/routers/api/v1/repo/pull.go b/routers/api/v1/repo/pull.go index 1c28363e8a..3974069ab4 100644 --- a/routers/api/v1/repo/pull.go +++ b/routers/api/v1/repo/pull.go @@ -204,6 +204,10 @@ func DownloadPullDiffOrPatch(ctx *context.APIContext) { // type: string // enum: [diff, patch] // required: true + // - name: binary + // in: query + // description: whether to include binary file changes. if true, the diff is applicable with `git apply` + // type: boolean // responses: // "200": // "$ref": "#/responses/string" @@ -225,7 +229,9 @@ func DownloadPullDiffOrPatch(ctx *context.APIContext) { patch = true } - if err := pull_service.DownloadDiffOrPatch(pr, ctx, patch); err != nil { + binary := ctx.FormBool("binary") + + if err := pull_service.DownloadDiffOrPatch(pr, ctx, patch, binary); err != nil { ctx.InternalServerError(err) return } |