[BUGFIX] Upload to the wrong storage

In some cases, the file is uploaded to the wrong storage

Change-Id: I6b3422cba3f0eb3a0d7e05233cff09f3cab1c41f
Releases: 3.0, 2.0
Resolves: #55858
Reviewed-on: https://review.typo3.org/27534
Reviewed-by: Fabien Udriot
Tested-by: Fabien Udriot