Commit ·
a55e8d7
1
Parent(s): 4b5364e
Fix: Make storage bucket public to prevent download errors
Browse files
backend/app/database/supabase_client.py
CHANGED
|
@@ -39,13 +39,18 @@ def initialize_storage():
|
|
| 39 |
bucket_names = [bucket.name for bucket in buckets]
|
| 40 |
|
| 41 |
if IMAGES_BUCKET not in bucket_names:
|
| 42 |
-
# Create bucket
|
| 43 |
supabase.storage.create_bucket(
|
| 44 |
IMAGES_BUCKET,
|
| 45 |
-
options={"public":
|
| 46 |
)
|
| 47 |
-
logger.info(f"Created storage bucket: {IMAGES_BUCKET}")
|
| 48 |
else:
|
| 49 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
except Exception as e:
|
| 51 |
logger.error(f"Error initializing storage: {e}")
|
|
|
|
| 39 |
bucket_names = [bucket.name for bucket in buckets]
|
| 40 |
|
| 41 |
if IMAGES_BUCKET not in bucket_names:
|
| 42 |
+
# Create bucket as public
|
| 43 |
supabase.storage.create_bucket(
|
| 44 |
IMAGES_BUCKET,
|
| 45 |
+
options={"public": True}
|
| 46 |
)
|
| 47 |
+
logger.info(f"Created public storage bucket: {IMAGES_BUCKET}")
|
| 48 |
else:
|
| 49 |
+
# Ensure the bucket is public if it already exists
|
| 50 |
+
supabase.storage.update_bucket(
|
| 51 |
+
IMAGES_BUCKET,
|
| 52 |
+
options={"public": True}
|
| 53 |
+
)
|
| 54 |
+
logger.info(f"Updated storage bucket to public: {IMAGES_BUCKET}")
|
| 55 |
except Exception as e:
|
| 56 |
logger.error(f"Error initializing storage: {e}")
|