From ca3330cecd9421e0b53f8e3b779aa9c69534b734 Mon Sep 17 00:00:00 2001 From: ᴜɴᴋɴᴡᴏɴ Date: Sun, 4 Oct 2020 18:40:39 +0800 Subject: lfs: ask client to always send the same value for the HTTP header (#6369) --- internal/route/lfs/batch.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'internal/route/lfs/batch.go') 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 { -- cgit v1.2.3