Skip to content

Mismatch status code in StorageException object and in exception message body. #1312

@mhmzdev

Description

@mhmzdev

Describe the bug
We're getting 2 different status code for an exception hence causing conflict which one to use.

To Reproduce

  1. Upload an entity in Storage bucket
  2. Make in accessible, could be wrong path name or file name
  3. Make the download API call

Expected behavior
The status code should be 404 both in StorageException object and in nested message param.

Screenshots

Image

Version (please complete the following information):
On Linux/macOS
Please run dart pub deps | grep -E "supabase|gotrue|postgrest|storage_client|realtime_client|functions_client" in your project directory and paste the output here.

hamza@M1-Max lensfolio_mobile_app % dart pub deps | grep -E "supabase|gotrue|postgrest|storage_client|realtime_client|functions_client"
├── supabase_flutter 2.12.0
│   ├── supabase 2.10.2
│   │   ├── functions_client 2.5.0
│   │   ├── gotrue 2.18.0
│   │   ├── postgrest 2.6.0
│   │   ├── realtime_client 2.7.0
│   │   ├── storage_client 2.4.1

Additional context
The object for me does exists on storage, the policy for storage is to read by any authenticated user yet i'm facing this issue.

  • Bucket name: 'resumes'
  • File path: 'resumes/uuid.png'

Code snippet:

  static Future<File> downloadResume(String filePath) async {
    try {
      final file = await AppSupabase.supabase.storage
          .from(SupaBuckets.resumes)
          .download(filePath);
      return File.fromRawPath(file);
    } catch (e, st) {
      if (e is StorageException) {
        throw SupaStorageFault.fromStorageException(e, st);
      }
      throw UnknownFault('Something went wrong!', st);
    }
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions