Skip to content

Commit

Permalink
Add opencsg check back to git http handler
Browse files Browse the repository at this point in the history
  • Loading branch information
Yiling-J committed Dec 25, 2024
1 parent 45af473 commit 378004a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions api/handler/git_http.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 378004a

Please sign in to comment.