diff --git a/app/notes.py b/app/notes.py index ce8ab56..d6a7a69 100644 --- a/app/notes.py +++ b/app/notes.py @@ -91,9 +91,8 @@ def edit(note_id): if note["featured_image"] is not None: r = supabase.storage.from_("featured_image").get_public_url( note["featured_image"], - options={"transform": {"width": 200}, "download": True}, + options={"transform": {"width": 200}}, ) - # image = f"data:image/png;base64," + base64.b64encode(r).decode("utf-8") image = r else: path = note["featured_image"] @@ -103,13 +102,11 @@ def edit(note_id): content = form.content.data is_public = form.is_public.data featured_image = form.featured_image.name - print(f"Featured: {featured_image}") if featured_image is not None: image = request.files[featured_image] image_stream = io.BytesIO() image.save(image_stream) path = f"{profile['id']}/{random_choice().lower()}_fi.png" - print(f"Path: {path}") try: if featured_image is not None: diff --git a/supabase/migrations/20230924205231_add_notes.sql b/supabase/migrations/20230924205231_add_notes.sql index 4d0659b..b156f78 100644 --- a/supabase/migrations/20230924205231_add_notes.sql +++ b/supabase/migrations/20230924205231_add_notes.sql @@ -37,8 +37,8 @@ to authenticated using (auth.uid() = author_id); -- Set up storage for featured_images -insert into storage.buckets (id, name) - values ('featured_image', 'featured_image'); +insert into storage.buckets (id, name, public) + values ('featured_image', 'featured_image', true); -- Set up access controls for storage. -- See https://supabase.com/docs/guides/storage#policy-examples for more details.