Skip to content

Commit 1738d75

Browse files
v2.0.1 (fix) : Fix for bucket upload response structure changes upstream (#14)
1 parent 852be1b commit 1738d75

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

demo/app.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
from st_social_media_links import SocialMediaIcons
66
from streamlit.components.v1 import html as st_html
77

8-
from st_supabase_connection import SupabaseConnection, __version__, execute_query
8+
from st_supabase_connection import execute_query # noqa: F401
9+
from st_supabase_connection import SupabaseConnection, __version__
910

1011
VERSION = __version__
1112

@@ -341,7 +342,6 @@
341342
if bucket_id:
342343
try:
343344
current_props = st_supabase.get_bucket(bucket_id)
344-
345345
st.info("Current properties fetched. Update values to update properties.")
346346
col1, col2, col3 = st.columns(3)
347347

@@ -681,16 +681,16 @@
681681
)
682682
elif (
683683
operation == "upload"
684-
and response["Key"] == f"{bucket_id}/{destination_path.lstrip('/')}"
684+
and response.full_path == f"{bucket_id}/{destination_path.lstrip('/')}"
685685
):
686686
try:
687687
st.success(
688-
f"Uploaded **{file.name}** to **{response['Key']}**",
688+
f"Uploaded **{file.name}** to **{response.full_path}**",
689689
icon="✅",
690690
)
691691
except AttributeError:
692692
st.success(
693-
f"Uploaded **{file}** to **{response['Key']}**",
693+
f"Uploaded **{file}** to **{response.full_path}**",
694694
icon="✅",
695695
)
696696
elif operation == "remove":

src/st_supabase_connection/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ def upload(
192192
"x-upsert": overwrite,
193193
},
194194
)
195-
return response.json()
195+
return response
196196

197197
def download(
198198
self,
@@ -374,9 +374,9 @@ def create_signed_urls(
374374
data = response.json()
375375
for item in data:
376376
if item["signedURL"]:
377-
item[
378-
"signedURL"
379-
] = f"{self.client.storage._client.base_url}{item['signedURL'].lstrip('/')}"
377+
item["signedURL"] = (
378+
f"{self.client.storage._client.base_url}{item['signedURL'].lstrip('/')}"
379+
)
380380

381381
return data
382382

0 commit comments

Comments
 (0)