Closed daniel-j-h closed 7 months ago
Here is one example to reproduce this
supabase storage cp
to upload an index.html
fileSee how
text/plain
Here is a workaround to upload a file with cache control and content type until we have it in the supabase storage cli
curl --proto =https --tlsv1.3 'https://xxxx.supabase.co/storage/v1/object/mybucket/index.html' \
-H "Authorization: Bearer $SUPABASE_SERVICE_KEY" \
-H 'Cache-Control: max-age=3600' \
-H 'Content-Type: text/html; charset=utf-8' \
--data-binary '@/tmp/index.html'
Note: an unrelated issue I ran into (also visible in the screen grab above) and what's not obvious as a user:
The content type text/html
is not supported on the storage API side at the moment
Even if we set text/html
manually, we'll get a text/plain
response back from the served content. It would be great to have this in the documentation somewhere. More on this in https://github.com/orgs/supabase/discussions/7377
Thanks for the suggestion. Currently the content-type
is automatically determined based on the first 512 bytes of the file being uploaded and the cache-control
defaults to max-age=3600
.
In the linked PR, I'm adding support for custom --cache-control
and --content-type
flags so that you can override these defaults. This will be released to beta version v1.141.0.
Is your feature request related to a problem? Please describe.
When using the supabase cli to interact with the storage layer, two crucial file options seem to be missing
Both file options seem to be present e.g. in the javascript library
Compare
fileOptions
(expand to see the options)These two missing options are crucial for certain workflows and use cases and the supabase storage cli would greatly benefit in supporting them. Otherwise the only workaround is using the javascript library for one-off scripts for these specific file upload use-cases, defeating the purpose of having the supabase storage cli in the first place.
Describe the solution you'd like
Ideally the supabase storage cli sub-commands creating or modifying files get two new optional arguments:
--cache-control
--content-type
Example usage
Describe alternatives you've considered
None
Additional context
As an inspiration, check the aws cli