Skip to content

Commit 54ce721

Browse files
QinYuuuuDev Agent
andauthored
fix upload databaset error (#607)
Co-authored-by: Dev Agent <dev-agent@example.com>
1 parent 709b8ad commit 54ce721

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

api/handler/git_http.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"io"
88
"log/slog"
99
"net/http"
10+
"opencsg.com/csghub-server/common/utils/common"
1011
"path/filepath"
1112
"strconv"
1213
"strings"
@@ -244,7 +245,8 @@ func (h *GitHTTPHandler) LfsBatchHF(ctx *gin.Context) {
244245
batchRequest.Namespace = ctx.Param("namespace")
245246
batchRequest.Name = ctx.Param("name")
246247
batchRequest.Name = strings.ReplaceAll(batchRequest.Name, ".git", "")
247-
batchRequest.RepoType = types.RepositoryType(ctx.Param("repo_type"))
248+
249+
batchRequest.RepoType = common.RepoTypeFromContext(ctx)
248250
if batchRequest.RepoType == "" {
249251
batchRequest.RepoType = types.ModelRepo
250252
}

api/router/api.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1083,6 +1083,17 @@ func createMappingRoutes(
10831083
{
10841084
hfdsFileGroup.GET("/:namespace/:name/resolve/:branch/*file_path", middleware.RepoMapping(types.DatasetRepo), repoCommonHandler.SDKDownload)
10851085
hfdsFileGroup.HEAD("/:namespace/:name/resolve/:branch/*file_path", middleware.RepoMapping(types.DatasetRepo), repoCommonHandler.HeadSDKDownload)
1086+
dsLfsGroup := hfdsFileGroup.Group("/:namespace/:name/info/lfs")
1087+
dsLfsGroup.Use(middleware.RepoType(types.DatasetRepo))
1088+
{
1089+
dsObjectsGroup := dsLfsGroup.Group("/objects")
1090+
{
1091+
dsObjectsGroup.POST("/batch", gitHTTPHandler.LfsBatchHF)
1092+
dsObjectsGroup.PUT("/:oid/:size", gitHTTPHandler.LfsUpload)
1093+
dsLfsGroup.GET("/:oid", gitHTTPHandler.LfsDownload)
1094+
}
1095+
dsObjectsGroup.POST("/verify", gitHTTPHandler.LfsVerify)
1096+
}
10861097
}
10871098
hfSpaceFileGroup := hfGroup.Group("/spaces")
10881099
{

0 commit comments

Comments
 (0)