mirror of
https://gitcode.com/gitea/gitea.git
synced 2025-06-28 08:11:02 +08:00
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>
This commit is contained in:
@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user