From 378004a9e669a11dc13e23b0719d5fca414e3a0e Mon Sep 17 00:00:00 2001 From: yiling Date: Tue, 24 Dec 2024 17:53:53 +0800 Subject: [PATCH] Add opencsg check back to git http handler --- api/handler/git_http.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/api/handler/git_http.go b/api/handler/git_http.go index a9bcb86b..2c22bf57 100644 --- a/api/handler/git_http.go +++ b/api/handler/git_http.go @@ -175,6 +175,11 @@ func (h *GitHTTPHandler) LfsBatch(ctx *gin.Context) { return } + s3Internal := ctx.GetHeader("X-OPENCSG-S3-Internal") + if s3Internal == "true" { + ctx.Set("X-OPENCSG-S3-Internal", true) + } + objectResponse, err := h.gitHttp.BuildObjectResponse(ctx, batchRequest, isUpload) if err != nil { if errors.Is(err, component.ErrUnauthorized) { @@ -235,6 +240,11 @@ func (h *GitHTTPHandler) LfsDownload(ctx *gin.Context) { downloadRequest.CurrentUser = httpbase.GetCurrentUser(ctx) downloadRequest.SaveAs = ctx.Query("save_as") + s3Internal := ctx.GetHeader("X-OPENCSG-S3-Internal") + if s3Internal == "true" { + ctx.Set("X-OPENCSG-S3-Internal", true) + } + url, err := h.gitHttp.LfsDownload(ctx, downloadRequest) if err != nil { httpbase.ServerError(ctx, err)