Description
Describe the bug
When using storage.buckets.<bucket_name>.objects_path = "./images"
on a local instance, if the file pulled in an svg
, the mimetype
is changed from image/svg+xml
to text/xml; charset=utf-8
.
The reason this is a problem: serving the image w/ mimetype text/xml; charset=utf-8
breaks compatibility with browsers if that image is then used client-side.
To Reproduce
Steps to reproduce the behavior:
- Create & go to
/supabase/images
, add an svg.- Confirm the file is an svg w/ correct mimetype:
xdg-mime query filetype FILE_PATH
. This returnsimage/svg+xml
for me.
- Confirm the file is an svg w/ correct mimetype:
- In your
config.toml
, enable the following:
[storage.buckets.images]
public = true
file_size_limit = "50MiB"
allowed_mime_types = ["image/*", "text/xml; charset=utf-8"]
objects_path = "./images"
npx supabase start
,npx supabase db reset --local --debug
for good measure- In studio, navigate to Storage, check the mimetype under the file name. Will be the mimetype returned via url access as well.
If I were to then delete the file in the same bucket, and replace it with the exact same file, but uploaded via the Storage UI, the file is loaded & works exactly as anticipated.
EDIT: For additional clarity: the eagle-eyed among you might notice that in lines from the config.toml
above, the allowed_mime_types
value of ["image/*", "text/xml; charset=utf-8"]
provides a clue re: where this problem may lie. I added that there because the value ["image/*"]
failed, whereas it should have succeed (given the file is of type image/svg+xml
according to xdg-mime
, as per the CLI command specified on step 1 above). When running npx-supabase db reset --local
, the loading of the SVG file into the bucket would fail, with an error saying that the type was not allowed, erroneously stating that the file was of type text/xml; charset=utf-8
. This is made even stranger by the fact that I could upload the exact same file via the Storage UI, and it was treated correctly by Supabase.
Expected behavior
The svg file maintains the correct mimetype
Screenshots
I can provide if the above is not enough info
System information
Rerun the failing command with --create-ticket
flag.
- Version of OS:
Debian GNU/Linux 12 (via WSL2)
- Version of CLI:
2.22.6
- Version of Docker:
v28.1.1
- Versions of services: [output from
supabase services
command]
SERVICE IMAGE | LOCAL | LINKED
------------------------|------------------------|------------
supabase/postgres | 15.8.1.077 | 15.8.1.077
supabase/gotrue | v2.171.0 | v2.171.0
postgrest/postgrest | v12.2.3 | v12.2.3
supabase/realtime | v2.34.47 | -
supabase/storage-api | v1.22.6 | v1.22.4
supabase/edge-runtime | v1.67.4 | -
supabase/studio | 2025.04.21-sha-173cc56 | -
supabase/postgres-meta | v0.88.9 | -
supabase/logflare | 1.12.0 | -
supabase/supavisor | 2.5.1 | -
Additional context
If applicable, add any other context about the problem here.
- Version of supabase-js: 2.49.4
- Version of Node.js: 23.11.0