supabase-community / storage-csharp

A C# implementation of Supabase's Object Storage API
https://supabase-community.github.io/storage-csharp/api/Supabase.Storage.Client.html
MIT License
19 stars 7 forks source link

Return Result Object From Upload #11

Closed MelbourneDeveloper closed 1 year ago

MelbourneDeveloper commented 1 year ago

Feature request

The Upload method on IStoreFileApi needs an IsSuccess flag and an error message.

Is your feature request related to a problem? Please describe.

I'm uploading files to a bucket, and the method is returning the path. However, the file never shows up in the bucket. Actually, I cannot upload files at all with this method. Clearly, the file is failing to upload, but I have no idea why.

Describe the solution you'd like

The Upload method should return a response model, like that in the other clients, and it should give an error to explain what went wrong. I've burned hours trying to upload a file and I still have no idea why it never shows up on the other side. It's probably just a permissions issue, but I have no feedback to tell me.

Describe alternatives you've considered

I can only think of using the JavaScript client instead.

acupofjose commented 1 year ago

Apologies for the delay in getting back to you, I've been out of town. You're right, it is likely a permissions issue, and agreed, the storage client is lagging a bit on feature parity with the supabase storage-js client. This is definitely an improvement we can make.

I'm going to transfer this issue to that repo so that we can track it there.

MelbourneDeveloper commented 1 year ago

@acupofjose Thankyou very much

acupofjose commented 1 year ago

@MelbourneDeveloper okay. I implemented it a little differently than you requested, but the Upload and Download methods will now throw exceptions if you are unauthorized to access them.

If it returns the path, you should now be confident in the path existing. I will be creating a new minor release with the updates here shortly before pushing it to the main supabase-csharp repo.

Again, apologies for the delay. But thank you for the issue, helpful bug catching here.