0
Fork 0
mirror of https://github.com/project-zot/zot.git synced 2024-12-16 21:56:37 -05:00

Merge pull request #49 from rchincha/blob-mount

routes: handle "mount blob" to remain compliant
This commit is contained in:
Serge Hallyn 2019-12-20 12:47:51 -06:00 committed by GitHub
commit e76804af4f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 0 deletions

View file

@ -505,6 +505,18 @@ func (rh *RouteHandler) CreateBlobUpload(w http.ResponseWriter, r *http.Request)
return
}
// blob mounts not allowed since we don't have access control yet, and this
// may be a uncommon use case, but remain compliant
if _, ok := r.URL.Query()["mount"]; ok {
w.WriteHeader(http.StatusMethodNotAllowed)
return
}
if _, ok := r.URL.Query()["from"]; ok {
w.WriteHeader(http.StatusMethodNotAllowed)
return
}
u, err := rh.c.ImageStore.NewBlobUpload(name)
if err != nil {
switch err {

View file

@ -377,6 +377,14 @@ func CheckWorkflows(t *testing.T, config *compliance.Config) {
So(resp.Header().Get("Content-Length"), ShouldEqual, "0")
})
Convey("Mount blobs", func() {
Print("\nMount blobs from another repository")
// create a upload
resp, err := resty.R().Post(baseURL + "/v2/repo/blobs/uploads/?digest=\"abc\"&&from=\"xyz\"")
So(err, ShouldBeNil)
So(resp.StatusCode(), ShouldEqual, 405)
})
Convey("Manifests", func() {
Print("\nManifests")
// create a blob/layer