Skip to content
This repository has been archived by the owner on May 4, 2021. It is now read-only.

Invalid push requests when tag included #7

Open
kalantar opened this issue Aug 29, 2014 · 0 comments
Open

Invalid push requests when tag included #7

kalantar opened this issue Aug 29, 2014 · 0 comments

Comments

@kalantar
Copy link

When an image name includes a tag, for example, of the form:
registry/namespace/repository:tag
an invalid push request is made. Currently, pushUrl is computed (in BuildPushAndDeleteImage()) as:
pushUrl := ("/v1.10/images/" + passedParams.Image_name + "/push")
Per the spec, https://docs.docker.com/reference/api/docker_remote_api_v1.14/#push-an-image-on-the-registry, the tag should be a query parameter. passedParams.Image_name should be parsed to identify whether or not a :tag is include. If so, it should be appended to the URL as "?tag=:tag"

Something like this should work:

    fullImageName := passedParams.Image_name
    registryNamespace := ""
    repository := fullImageName
    tag := ""
    repositoryIdx := strings.LastIndex(fullImageName, "/")
    if repositoryIdx > 0 {
            registryNamespace = fullImageName[:repositoryIdx]
            repository = fullImageName[repositoryIdx:]
            splitStrings := strings.Split(repository, ":")
            repository = splitStrings[0]
            tag = splitStrings[1]
    }
    pushUrl := ("/v1.10/images/" + registryNamespace + repository + "/push")
    if tag != "" {
            pushUrl = (pushUrl + "?tag=" + tag)
    }
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant