[BUGFIX] Pass path instead of object to fileExistsInFolder

In ResourceStorage in the method getUniqueName second argument
passed to fileExistsInFolder should be string instead of object.

This fixes an exception thrown when trying to insert magic image
in the RTE.

Resolves: #55763
Releases: 6.2
Change-Id: I4ed624d4ea5a3602936cf8493052ef111a391990
Reviewed-on: https://review.typo3.org/27412
Reviewed-by: Michiel Roos
Reviewed-by: Marcin Sągol
Reviewed-by: Frans Saris
Tested-by: Frans Saris
Reviewed-by: Steffen Ritter
Tested-by: Steffen Ritter