From e7de2fc1367e17c2d95add9ded102f981d991f16 Mon Sep 17 00:00:00 2001 From: Giteabot Date: Fri, 13 Dec 2024 11:41:12 +0800 Subject: [PATCH] Fix lfs migration (#32812) (#32818) Backport #32812 by @hiifong Fix: #32803 ![image](https://github.com/user-attachments/assets/3ea1f4e0-e26f-4a15-957e-dd6caf91deb1) ![image](https://github.com/user-attachments/assets/44b99624-c347-4f2d-a11c-13ec1276eea2) Co-authored-by: hiifong --- modules/lfs/http_client.go | 1 + modules/lfs/shared.go | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/lfs/http_client.go b/modules/lfs/http_client.go index 427f57df2d458..94d5333de534b 100644 --- a/modules/lfs/http_client.go +++ b/modules/lfs/http_client.go @@ -211,6 +211,7 @@ func createRequest(ctx context.Context, method, url string, headers map[string]s req.Header.Set(key, value) } req.Header.Set("Accept", AcceptHeader) + req.Header.Set("User-Agent", UserAgentHeader) return req, nil } diff --git a/modules/lfs/shared.go b/modules/lfs/shared.go index aef9e456fcdd9..b1996517652e0 100644 --- a/modules/lfs/shared.go +++ b/modules/lfs/shared.go @@ -15,7 +15,8 @@ const ( // MediaType contains the media type for LFS server requests MediaType = "application/vnd.git-lfs+json" // Some LFS servers offer content with other types, so fallback to '*/*' if application/vnd.git-lfs+json cannot be served - AcceptHeader = "application/vnd.git-lfs+json;q=0.9, */*;q=0.8" + AcceptHeader = "application/vnd.git-lfs+json;q=0.9, */*;q=0.8" + UserAgentHeader = "git-lfs" ) // BatchRequest contains multiple requests processed in one batch operation.