1up-lab/OneupUploaderBundle — pull request #80 by mitom (2013-12-16 13:39:42+00:00)
Title: [Critical] fixed uploads not being retryable if there was an error

Fixes 2 things, both only apply when using the gaufrette chunk storage and they both apply to the same sitaution:
If an upload fails after the file has been reassembled completely, it is renamed to it's original name (the 0_ index is removed). However if the upload fails somewhere *after* reassembling and *before* the `cleanUp` function the file will stay there. This only happens if a user is trying to upload a file under the same name twice (or more) in the same session and the one before the last fails.

The 2 problems this causes:

1. This is the critical one. The `getChunks` method used to include *all* files in the directory, therefore if the user tried to re-upload the file again, it was appended to the previously re-assembled file, corrupting it if it succeeded. Now it only includes files which have indexes (0_) therefore avoiding assembling chunks to a file which was left there by an error.

2. The file is unrecoverable by the user and if it is not deleted he will not be able to re-upload it until it is removed, or until he starts a new session (users probably won't log-out/in again), so I think it's okay to just remove it.