[BUGFIX] Correct storage selection (common prefixes)

If there is a local storage "uploads/test/" and a requested file
is in "uploads/other/file.txt", the storage matching will not
consider this storage for this file anymore, although they share a
common prefix, but will use a correct matching storage (e.g. 0).

Releases: 6.2, 6.1, 6.0
Resolves: #52173
Change-Id: Id14ffd6620554c086b6e77dca285ade8dee39ab2
Reviewed-on: https://review.typo3.org/23966
Reviewed-by: Markus Klein
Tested-by: Markus Klein
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind