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

Handle failed or omitted file uploads #1699

Open
open-dynaMIX opened this issue Mar 2, 2022 · 0 comments
Open

Handle failed or omitted file uploads #1699

open-dynaMIX opened this issue Mar 2, 2022 · 0 comments

Comments

@open-dynaMIX
Copy link
Member

open-dynaMIX commented Mar 2, 2022

When saving a FileAnswer, Caluma assumes that the file is uploaded to the bucket afterwards. There are cases where this doesn't happen and Caluma has data about a file that doesn't exist in the bucket. For example, when the upload to MinIO fails for some reason, the browser crashes or something similar.

We want to know when a file is not uploaded, and treat FileAnswers without actual file as potentially equal to non-existing.

Proposal

In Alexandria we let MinIO call an endpoint on our side after completed uploads. There we use it to generate Thumbnails (https://github.com/projectcaluma/alexandria/blob/main/alexandria/core/views.py#L144). The same mechanism could be used in Caluma to know if a file really was uploaded.

Process

The process would look like this:

  1. Client saves FileAnswer in Caluma
  2. Caluma saves the File and marks it as "draft"
  3. Client uploads file to the bucket
  4. MinIO send a request to Caluma, informing about the newly uploaded file
  5. Caluma unmarks the File as draft.

Caluma then could treat draft Files as non-existent and also ignore the corresponding FileAnswer.

Implementation suggestion

  • Add draft flag to File model
  • Add draft flag to GQL schema, so frontend can treat it accordingly
  • Add webhook to mark a file as "successfully uploaded"
  • Extend documentation
maria-pw pushed a commit to maria-pw/caluma that referenced this issue Jul 20, 2023
maria-pw pushed a commit to maria-pw/caluma that referenced this issue Jul 24, 2023
maria-pw pushed a commit to maria-pw/caluma that referenced this issue Jul 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant