File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change 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 }
Original file line number Diff line number Diff 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 {
You can’t perform that action at this time.
0 commit comments