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

Allow stopping uploads in PatchRequest before any data is passed to the store #1063

Closed
quality-leftovers opened this issue Jan 12, 2024 · 3 comments

Comments

@quality-leftovers
Copy link

Is your feature request related to a problem? Please describe.
Right now uploads can be rejected in PreUploadCreateCallback or stopped in PostReceive (writeChunk).

I'd like to be able to Stop the upload before any data is written since if a condition that should stop the upload (like user has exceeded a quota) has occured the upload should not progress at all IMHO.

Such a hook would also be a good place to validate access token fields (just checking the user shuold be allowed to write to an upload path - token validity should be validated by middleware IMHO)

Describe the solution you'd like
There should be a pre-receive/pre-resume-upload hook that is called blockingly, before any data is passed to the store.

Describe alternatives you've considered

  • Relying on the PostReceive hook
  • Using a custom middleware: Don't like that because it adds compexity and needs to be checked/tested with every tusd revision

Can you provide help with implementing this feature?
Would be willing to give implementing it a try

Additional context
none

@Acconut
Copy link
Member

Acconut commented Jan 15, 2024

In previous issues we have discussed adding a new hook for authenticating and authorizing read and write access to uploads: #669. For example, before the PATCH request will modify the resource, a hook is dispatched to ensure that the write access is allows. This is were you could place the check for you quota limit.

That would be a more reusable and general purpose than adding a specific hook for just PATCH requests.

@quality-leftovers
Copy link
Author

Did not see that issue, should've searched for Authentication.
=> This issue can probably be closed as duplicate

@Acconut
Copy link
Member

Acconut commented Jan 16, 2024

Alright, I will close this then.

@Acconut Acconut closed this as completed Jan 16, 2024
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

2 participants