-
Notifications
You must be signed in to change notification settings - Fork 308
feat: functions download foo --use-api
#4381
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
base: develop
Are you sure you want to change the base?
Conversation
Pull Request Test Coverage Report for Build 19088750195Details
💛 - Coveralls |
3444cce to
fb7041d
Compare
fb7041d to
3eedb2c
Compare
| // remove leading source/ or :slug/ | ||
| func normalizeRelativePath(slug, raw string) string { | ||
| cleaned := path.Clean(raw) | ||
| if after, ok := strings.CutPrefix(cleaned, "source/"); ok { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if user legitimately uses a directory named source? I think it's too magical to deal with it here.
A more general solve for this is to return another path header that can be used to indicate the root directory to extract. For eg.
We may have source/index.ts as the file path. By specifying source as the path header, the file will be downloaded to supabase/functions/slug/index.ts. Otherwise it will be extracted to supabase/functions/slug/source/index.ts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternatively, we can also make use of the entrypoint path field of the metadata to locate the desired slug directory within the eszip bundle.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think a better approach would be to look at the entrypoint (this may need an extra request to get metadata) and figure out the common base path. You can look at how it's implemented in the dashboard https://github.com/supabase/supabase/blob/master/apps/studio/pages/project/%5Bref%5D/functions/%5BfunctionSlug%5D/code.tsx#L178-L197
…upabase/cli into DEVWF-756/server-side-unbundle
…756/server-side-unbundle
What kind of change does this PR introduce?
Feature DEVWF-756
What is the current behavior?
supabase functions download foospins up an edge-runtime container to download the eszip bundle and writes it to the filesystemWhat is the new behavior?
supabase functions download foo --use-apicalls the mgmt-api to unbundle the eszip on the server, then returns it as a multipart response and writes it to the filesystemParity
We expect that whether you choose to
--use-apior not you should end up with the same files on disk.Additional context
Add any other context or screenshots.