Skip to content

fix: use authenticated endpoint prefixes #228

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

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

Conversation

itslenny
Copy link
Contributor

@itslenny itslenny commented May 16, 2025

What kind of change does this PR introduce?

Bug fix

What is the current behavior?

Currently download(), exists(), and info() use the /object/:bucketName/* routes which causes routing errors for buckets named public because the requests get routed to /object/public/:bucketName/* and the first part of the path is used as the bucket name.

This makes it impossible to perform these operations on any objects in a folder inside of a bucket named "public"

What is the new behavior?

storage.from('public').download('something/file.png')

GET /object/:bucketName/* -> GET /object/authenticated/:bucketName/*

prevents routing to: GET /object/public/:bucketName/*

storage.from('public').info('something/file.png')

GET /object/info/:bucketName/* -> GET /object/info/authenticated/:bucketName/*

prevents routing to: GET /object/info/public/:bucketName/*

storage.from('public').exists('something/file.png')

HEAD /object/:bucketName/* -> HEAD /object/authenticated/:bucketName/*

prevents routing to: HEAD /object/public/:bucketName/*

Additional context

A bucket with the name "public" causes issues with our api route resolution.

For example, if an object's path is public/something/file.png:

A request to /object/info/:bucketName/* routes to /object/info/public/:bucketName/* and returns a BUCKET NOT FOUND error for the bucket "something"

Also, a request to /object/:bucketName/* routes to /object/public/:bucketName/* and results in the same error

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