Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Relax location_header_to_url path handling #175

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

joonas
Copy link

@joonas joonas commented Oct 13, 2024

When testing this library against Google Cloud Artifact Registry, I noticed the upload URL they return when obtaining a session id differs from the spec.

Instead of returning a Location: as specified in the OCI Distribution spec:

/v2/<name>/blobs/upload/<reference>

GCP Artifactory Registry returns the following Location: header:

/artifacts-uploads/namespaces/<gcp-project-id>/repositories/<artifact-registry-repository>/uploads/<some-hash>

I would like to propose relaxing the location_header_to_url code slightly to allow the use of this returned header, which does seem based to be on a perhaps slightly "looser interpretation" of what the spec says under POST then PUT:

Upon success, the response MUST have a code of 202 Accepted, and MUST include the following header:

Location: <location>

The MUST contain a UUID representing a unique session ID for the upload to follow. The does not necessarily need to be provided by the registry itself. In fact, offloading to another server can be a better strategy.

Optionally, the location MAY be absolute (containing the protocol and/or hostname), or it MAY be relative (containing just the URL path). For more information, see RFC 7231.

To further motivate this, 'd like to point out that the oras-go handles this without any issue, so it would seem reasonable to try to align the behavior between the two libraries in this regard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant