ankitpokhrel / ankitpokhrel/tus-php
Deleting the cache entry inside the upload.complete event makes the completing request itself return 410
- Lingua principale
- PHP
- Stelle
- 1.5k
- Fork
- 220
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
**Version:** v2.4.0
## Summary
If a host application deletes the upload's cache entry from inside the `tus-server.upload.complete` event handler (a natural pattern for "consume the upload on completion" flows), the server's own post-event re-read of that entry causes the very request that just succeeded to respond **410 Gone** — the client is told its successful upload failed, and clients like Uppy surface an error for an upload that actually completed.
## Reproduce
1. Register a listener on `tus-server.upload.complete` that processes the finished file and then deletes the upload's cache entry (e.g. `$cache->delete($key)`).
2. Complete an upload (final PATCH).
3. The PATCH response is 410 instead of 204, despite the file having been fully received and the listener having run successfully.
## Workaround we use
Defer cache retirement until after the response object is built, within the same request.
## Suggested fix
Snapshot the file/cache state needed for the response before dispatching the completion event, or document that the cache entry must outlive the event handler.
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Valutazione
Questa issue non è ancora stata valutata.