ankitpokhrel / ankitpokhrel/tus-php
Deleting the cache entry inside the upload.complete event makes the completing request itself return 410
- Vorherrschende Sprache
- PHP
- Sterne
- 1.5k
- Forks
- 220
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
**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.
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Bewertung
Dieses Issue wurde noch nicht bewertet.