Skip to content

Why dont't using reference.Path(named) instead of named.Name() when building registry v2 API URLs #14

Open
@lesomnus

Description

@lesomnus

I understand that reference.Named may not contains the domain part according to its implementation. However, the
function ParseNamed(s string) (Named, error) requires given s to be canonical which conatins the domain part.

Assume that we have reference.Named that holds "cr.io/foo/bar" where domain is "cr.io". The URL build functions such as (ub *URLBuilder) BuildTagsURL(name reference.Named, values ...url.Values)
generates URL "/v2/cr.io/foo/bar" but it must be "/v2/foo/bar".

How about replacing all named.Name() in distribution/registry/api/v2/url.go into reference.Path(named) to give its intention? Or how about remvoe domain part from the argument inNewRepository(name reference.Named, baseURL string, transport http.RoundTripper) to prevent misintended result?

If the current implementation (using named.Name()) is intended, can you explain why it is? If not, please tell me which of the above two methods would be better. I will make PR for this (I think the former way is better).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions