working commit
This commit is contained in:
+17
-10
@@ -29,9 +29,12 @@ func (hand *Handler) BlobExists(rctx *router.Context) {
|
||||
res, code, err := hand.oper.BlobExists(ctx, params)
|
||||
if err != nil {
|
||||
hand.logg.Errorf("BlobExist error: %v", err)
|
||||
} else if res.Exists {
|
||||
}
|
||||
if code == http.StatusOK {
|
||||
rctx.SetHeader("Docker-Content-Digest", res.DockerContentDigest)
|
||||
rctx.SetHeader("Content-Length", res.ContentLength)
|
||||
rctx.SetHeader("Content-Type", res.ContentType)
|
||||
|
||||
}
|
||||
rctx.SetStatus(code)
|
||||
}
|
||||
@@ -139,18 +142,22 @@ func (hand *Handler) GetBlob(rctx *router.Context) {
|
||||
hand.logg.Errorf("GetBlob error: %v", err)
|
||||
}
|
||||
|
||||
rctx.SetHeader("Content-Length", res.ContentLength)
|
||||
rctx.SetHeader("Content-Type", res.ContentType)
|
||||
rctx.SetHeader("Docker-Content-Digest", res.DockerContentDigest)
|
||||
rctx.SetStatus(code)
|
||||
if code == http.StatusOK {
|
||||
rctx.SetHeader("Content-Length", res.ContentLength)
|
||||
rctx.SetHeader("Content-Type", res.ContentType)
|
||||
rctx.SetHeader("Docker-Content-Digest", res.DockerContentDigest)
|
||||
rctx.SetStatus(code)
|
||||
|
||||
defer res.ReadCloser.Close()
|
||||
_, err = io.Copy(rctx.Writer, res.ReadCloser)
|
||||
if err != nil {
|
||||
hand.logg.Errorf("GetFile error: %v", err)
|
||||
rctx.SetStatus(http.StatusInternalServerError)
|
||||
defer res.ReadCloser.Close()
|
||||
_, err = io.Copy(rctx.Writer, res.ReadCloser)
|
||||
if err != nil {
|
||||
hand.logg.Errorf("GetFile error: %v", err)
|
||||
rctx.SetStatus(http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
rctx.SetStatus(code)
|
||||
}
|
||||
|
||||
// DELETE /v2/<name>/blobs/<digest> 202 404/405
|
||||
|
||||
Reference in New Issue
Block a user