aboutsummaryrefslogtreecommitdiff
path: root/internal/route/lfs/batch.go
diff options
context:
space:
mode:
authorᴜɴᴋɴᴡᴏɴ <u@gogs.io>2020-10-04 18:40:39 +0800
committerGitHub <noreply@github.com>2020-10-04 18:40:39 +0800
commitca3330cecd9421e0b53f8e3b779aa9c69534b734 (patch)
tree987b7a6b5764847d263af664a50f1532cc10ee0f /internal/route/lfs/batch.go
parentcf86546dff822cfc316832ed61deaf2c28880447 (diff)
lfs: ask client to always send the same value for the HTTP header (#6369)
Diffstat (limited to 'internal/route/lfs/batch.go')
-rw-r--r--internal/route/lfs/batch.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/internal/route/lfs/batch.go b/internal/route/lfs/batch.go
index 4f720948..bfc364c2 100644
--- a/internal/route/lfs/batch.go
+++ b/internal/route/lfs/batch.go
@@ -44,6 +44,11 @@ func serveBatch(c *macaron.Context, owner *db.User, repo *db.Repository) {
actions = batchActions{
Upload: &batchAction{
Href: fmt.Sprintf("%s/%s", baseHref, obj.Oid),
+ Header: map[string]string{
+ // NOTE: git-lfs v2.5.0 sets the Content-Type based on the uploaded file.
+ // This ensures that the client always uses the designated value for the header.
+ "Content-Type": "application/octet-stream",
+ },
},
Verify: &batchAction{
Href: fmt.Sprintf("%s/verify", baseHref),
@@ -136,7 +141,8 @@ type batchError struct {
}
type batchAction struct {
- Href string `json:"href"`
+ Href string `json:"href"`
+ Header map[string]string `json:"header,omitempty"`
}
type batchActions struct {