ankitpokhrel / ankitpokhrel/tus-php

Deleting the cache entry inside the upload.complete event makes the completing request itself return 410

Abierto
#468 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
PHP
Estrellas
1.5k
Forks
220
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

**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.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.