MCPcopy Create free account
hub / github.com/OpenListTeam/OpenList / S3

Function S3

server/s3.go:14–34  ·  view source on GitHub ↗
(g *gin.RouterGroup)

Source from the content-addressed store, hash-verified

12)
13
14func S3(g *gin.RouterGroup) {
15 if !conf.Conf.S3.Enable {
16 g.Any("/*path", func(c *gin.Context) {
17 common.ErrorStrResp(c, "S3 server is not enabled", 403)
18 })
19 return
20 }
21 if conf.Conf.S3.Port != -1 {
22 g.Any("/*path", func(c *gin.Context) {
23 common.ErrorStrResp(c, "S3 server bound to single port", 403)
24 })
25 return
26 }
27 h, _ := s3.NewServer(context.Background())
28
29 g.Any("/*path", func(c *gin.Context) {
30 adjustedPath := strings.TrimPrefix(c.Request.URL.Path, path.Join(conf.URL.Path, "/s3"))
31 c.Request.URL.Path = adjustedPath
32 gin.WrapH(h)(c)
33 })
34}
35
36func S3Server(g *gin.RouterGroup) {
37 h, _ := s3.NewServer(context.Background())

Callers 1

InitFunction · 0.70

Calls 2

ErrorStrRespFunction · 0.92
NewServerFunction · 0.92

Tested by

no test coverage detected