feat: add s3 blob handler(by readll all :( )
This commit is contained in:
@ -17,6 +17,7 @@ import (
|
||||
"nf-repo/internal/opt"
|
||||
"nf-repo/internal/util/r"
|
||||
"nf-repo/internal/util/rerr"
|
||||
"nf-repo/internal/util/tools"
|
||||
"strings"
|
||||
)
|
||||
|
||||
@ -186,7 +187,8 @@ func ProxyDownloadImage(mh interfaces.ManifestHandler, bh interfaces.BlobHandler
|
||||
})
|
||||
_ = c.Flush()
|
||||
|
||||
if des, err = puller.Get(c.Request.Context(), tn); err != nil {
|
||||
ctx := tools.TimeoutCtx(c.Request.Context())
|
||||
if des, err = puller.Get(ctx, tn); err != nil {
|
||||
return r.Resp500(c, err.Error())
|
||||
}
|
||||
|
||||
|
@ -2,8 +2,10 @@ package handler
|
||||
|
||||
import (
|
||||
"github.com/loveuer/nf"
|
||||
"github.com/sirupsen/logrus"
|
||||
"nf-repo/internal/interfaces"
|
||||
"nf-repo/internal/opt"
|
||||
"nf-repo/internal/util/rerr"
|
||||
)
|
||||
|
||||
type blob struct {
|
||||
@ -39,8 +41,14 @@ func Root(bh interfaces.BlobHandler, uh interfaces.UploadHandler, mh interfaces.
|
||||
return handleReferrers(c, mh)
|
||||
}
|
||||
|
||||
c.Set("Docker-Distribution-API-Version", "registry/2.0")
|
||||
c.SetHeader("Docker-Distribution-API-Version", "registry/2.0")
|
||||
|
||||
return c.SendStatus(200)
|
||||
logrus.
|
||||
WithField("path", c.Path()).
|
||||
WithField("method", c.Method()).
|
||||
WithField("headers", c.Request.Header).
|
||||
Warn()
|
||||
|
||||
return rerr.Error(c, rerr.ErrUnauthorized)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user