Corrupted File on upload

Hi! I am using supabase-js
"@supabase/supabase-js": "^2.50.0",


I am facing an issue where every upload that I did contains this in the file header

------WebKitFormBoundaryq1P65x9Cx4VFT0SU
Content-Disposition: form-data; name="cacheControl"

3600
------WebKitFormBoundaryq1P65x9Cx4VFT0SU
Content-Disposition: form-data; name=""; filename="topsecret.txt"
Content-Type: application/octet-stream


When uploading via the dashboard, the file uploads fine. When uploading via the JS SDK, the header get inserted to every file happens. Here are my code snippets


const handleFileChange = (event: React.ChangeEvent<HTMLInputElement>) => {
        const selectedFiles = event.target.files;
        if (selectedFiles && selectedFiles.length > 0) {
            const file = event.target.files?.[0]
            if(file != null){
                supabase.storage.from("bucket-name").upload(`users/abc/testUpload/${file?.name}`, file, {
                    upsert: true,
                    contentType: "text/plain"
                }).then(file => {
                    console.log(file.data)
                })
            }   
        }
    };

I did have a browse through the issue tracker(https://github.com/supabase/supabase/issues/36929) and this seems related? Anyone facing the same issue?
GitHub
Bug report Hello, I&#39;m experiencing a critical bug with Supabase Storage in my project. Project Ref: gnmxihdaawlenwspsxum Region: sa-east-1 Problem: When I upload a valid PNG file (e.g., ~745KB)...
Was this page helpful?