Skip to content

OCI: returned URLs have an unexpanded endpoint template in the host - #59

Merged
pksgit merged 1 commit into
mainfrom
fix-oci-endpoint-template-host
Oct 23, 2026
Merged

pksgit merged 1 commit into
mainfrom
fix-oci-endpoint-template-host

Conversation

@pksgit

@pksgit pksgit commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

What breaks

On an OCI store with no endpoint configured, every URL the store returns is unusable:

  • The location returned by UploadFile, e.g. https://objectstorage.us-chicago-1.%7BdualStack%3Fds.oci.:%7Doraclecloud.com/n/<ns>/b/<bucket>/o/<key>
  • The pre-authenticated request link returned by PresignedURL

The host is not a valid hostname, so these URLs can't be fetched, and Go's url.Parse rejects them outright ("invalid port"). Anything that stores these URLs or hands them to users gets links that don't open. The upload itself succeeds, and removing the {dualStack...} segment by hand gives a working link.

Not affected: object operations (put, get, list, delete, exists), which the SDK sends to the correct host, and stores with endpoint set.

This starts with oci-go-sdk v65.126.1, which this module has required since #51.

Cause

v65.126.1 adds a {dualStack?ds.oci.:} option to the Object Storage endpoint template. The SDK fills it in on a copy of the client for each request, so client.Host keeps the raw template, and NewOCI saved that raw value as the host it builds URLs from.

Fix

NewOCI fills in the endpoint options with common.UpdateEndpointTemplateForOptions on a copy of the client before saving the host, the same way the SDK does for each request. The URL host is then objectstorage.<region>.oraclecloud.com, or objectstorage.<region>.ds.oci.oraclecloud.com when dual-stack is enabled. TestOCILocationHost checks the host of a returned location; it fails on main with the parse error above.

Not covered

With OCI_REALM_SPECIFIC_SERVICE_ENDPOINT_TEMPLATE_ENABLED, the oc1 template also has {namespaceName+Dot}, which still ends up in the saved host. That predates this change.

🤖 Generated with Claude Code

On an OCI store with no endpoint configured, the location returned by
UploadFile and the link returned by PresignedURL had a host such as
objectstorage.us-chicago-1.{dualStack?ds.oci.:}oraclecloud.com, so they
could not be fetched. Uploads and other object operations were unaffected.

oci-go-sdk v65.126.1 adds the {dualStack?...} option to the Object Storage
endpoint template and fills it in per request on a copy of the client, so
client.Host keeps the raw template. NewOCI now fills in the endpoint options
with common.UpdateEndpointTemplateForOptions on a copy before saving the host.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pksgit
pksgit merged commit 1262856 into main Oct 23, 2026
11 checks passed
@pksgit
pksgit deleted the fix-oci-endpoint-template-host branch October 23, 2026 16:09
pksgit added a commit to livekit/egress that referenced this pull request Oct 23, 2026
OCI upload locations and presigned URLs had an unexpanded endpoint
template in the host. Fixed in livekit/storage#59.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.

2 participants