MCPcopy Create free account
hub / github.com/OpenCSGs/csghub-server / buildUploadLink

Method buildUploadLink

component/git_http.go:687–694  ·  view source on GitHub ↗

func (c *GitHTTPComponent) buildUploadLink(req types.BatchRequest, pointer types.Pointer) string { return c.config.APIServer.PublicDomain + "/" + path.Join(fmt.Sprintf("%ss", req.RepoType), url.PathEscape(req.Namespace), url.PathEscape(req.Name+".git"), "info/lfs/objects", url.PathEscape(pointer.Oi

(req types.BatchRequest, pointer types.Pointer)

Source from the content-addressed store, hash-verified

685// }
686
687func (c *GitHTTPComponent) buildUploadLink(req types.BatchRequest, pointer types.Pointer) string {
688 objectKey := path.Join("lfs", pointer.RelativePath())
689 u, err := c.s3Client.PresignedPutObject(context.Background(), c.config.S3.Bucket, objectKey, time.Hour*24)
690 if err != nil {
691 return c.config.APIServer.PublicDomain + "/" + path.Join(fmt.Sprintf("%ss", req.RepoType), url.PathEscape(req.Namespace), url.PathEscape(req.Name+".git"), "info/lfs/objects", url.PathEscape(pointer.Oid), strconv.FormatInt(pointer.Size, 10))
692 }
693 return u.String()
694}
695
696func (c *GitHTTPComponent) buildVerifyLink(req types.BatchRequest) string {
697 return c.config.APIServer.PublicDomain + "/" + path.Join(fmt.Sprintf("%ss", req.RepoType), url.PathEscape(req.Namespace), url.PathEscape(req.Name+".git"), "info/lfs/verify")

Callers 1

buildObjectResponseMethod · 0.95

Calls 1

RelativePathMethod · 0.45

Tested by

no test coverage detected