Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Writing binary files #1171

Open
wants to merge 36 commits into
base: main
Choose a base branch
from
Open

Writing binary files #1171

wants to merge 36 commits into from

Conversation

loiswells97
Copy link
Contributor

@loiswells97 loiswells97 commented Jan 22, 2025

At the moment, the batching means that when an image is created, the main thread interprets that as separate images and creates a bunch of invalid files with the same name. To stop this happening, we probably need to modify the response on the frontend to ensure that the batched writes all hit the same file and append to rather than overwrite the existing content. The question we will have is when do we want existing files to be overwritten and when do we want them to be appended to and how can we tell? For example, if it's another batch of binary from the same request then we might want it to append, whereas if it's another request from the user, we might want it to overwrite. Maybe we need some metadata to give a unique ID to the request?

Question: How do we want to deal with image files created by a user who is not logged in? Do we want to let them save the image to the bucket anyway? Or should it be saved in localStorage somehow? An MVP option could be to tell them they have to log in to add images to the project, although not ideal.

Also, we may need some changes on the API side to stop writing to a filename that already exists creating multiple files with the same name in the same project. Can we have an update image endpoint as well as a create image endpoint? And if so, would we overwrite the original image in the bucket? In other words, how would this work in practice?

Work out why updating an image only works after the page has been reloaded, otherwise it creates a second image with the same name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant