0
Fork 0
mirror of https://github.com/project-zot/zot.git synced 2024-12-30 22:34:13 -05:00

conformance: fix cross-mount behavior when 'from' is missing

fixes issue #442

Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com>
This commit is contained in:
Ramkumar Chinchani 2022-03-04 23:21:30 +00:00 committed by Ramkumar Chinchani
parent 95e4b2054b
commit 4be2652085
2 changed files with 2 additions and 9 deletions

View file

@ -2665,7 +2665,7 @@ func TestCrossRepoMount(t *testing.T) {
SetBasicAuth(username, passphrase).SetQueryParams(params).
Post(baseURL + "/v2/zot-mount-test/blobs/uploads/")
So(err, ShouldBeNil)
So(postResponse.StatusCode(), ShouldEqual, http.StatusMethodNotAllowed)
So(postResponse.StatusCode(), ShouldEqual, http.StatusAccepted)
params = make(map[string]string)
params["from"] = "zot-cve-test"
@ -3902,7 +3902,7 @@ func TestRouteFailures(t *testing.T) {
resp = response.Result()
defer resp.Body.Close()
So(resp, ShouldNotBeNil)
So(resp.StatusCode, ShouldEqual, http.StatusMethodNotAllowed)
So(resp.StatusCode, ShouldEqual, http.StatusAccepted)
})
Convey("Get blob upload", func() {

View file

@ -716,13 +716,6 @@ func (rh *RouteHandler) CreateBlobUpload(response http.ResponseWriter, request *
return
}
from, ok := request.URL.Query()["from"]
if !ok || len(from) != 1 {
response.WriteHeader(http.StatusMethodNotAllowed)
return
}
// zot does not support cross mounting directly and do a workaround creating using hard link.
// check blob looks for actual path (name+mountDigests[0]) first then look for cache and
// if found in cache, will do hard link and if fails we will start new upload.