fix: use authenticated endpoint prefixes #228
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What kind of change does this PR introduce?
Bug fix
What is the current behavior?
Currently
download()
,exists()
, andinfo()
use the/object/:bucketName/*
routes which causes routing errors for buckets namedpublic
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