Closed quality-leftovers closed 5 months ago
In previous issues we have discussed adding a new hook for authenticating and authorizing read and write access to uploads: https://github.com/tus/tusd/issues/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.
Did not see that issue, should've searched for Authentication. => This issue can probably be closed as duplicate
Alright, I will close this then.
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
Can you provide help with implementing this feature? Would be willing to give implementing it a try
Additional context none