diff --git a/Build/phpstan/phpstan-baseline.neon b/Build/phpstan/phpstan-baseline.neon
index ff28a8e7c52f54e0199e3041655cf37694922b53..d32291210dd494b1b9b1b2f8e02d4724fe047f17 100644
--- a/Build/phpstan/phpstan-baseline.neon
+++ b/Build/phpstan/phpstan-baseline.neon
@@ -1440,16 +1440,6 @@ parameters:
 			count: 1
 			path: ../../typo3/sysext/core/Classes/Resource/ResourceFactory.php
 
-		-
-			message: "#^Parameter \\#1 \\$uid of method TYPO3\\\\CMS\\\\Core\\\\Resource\\\\StorageRepository\\:\\:findByUid\\(\\) expects int, string given\\.$#"
-			count: 1
-			path: ../../typo3/sysext/core/Classes/Resource/ResourceFactory.php
-
-		-
-			message: "#^Parameter \\#1 \\$uid of method TYPO3\\\\CMS\\\\Core\\\\Resource\\\\StorageRepository\\:\\:findByUid\\(\\) expects int, string\\|null given\\.$#"
-			count: 1
-			path: ../../typo3/sysext/core/Classes/Resource/ResourceFactory.php
-
 		-
 			message: "#^Call to an undefined method TYPO3\\\\CMS\\\\Core\\\\Resource\\\\FileInterface\\:\\:getCombinedIdentifier\\(\\)\\.$#"
 			count: 2
diff --git a/typo3/sysext/core/Classes/Resource/ResourceFactory.php b/typo3/sysext/core/Classes/Resource/ResourceFactory.php
index 89fee19ba4409d16e21545ba22a31d92e94c6a04..bd05958cc52f0093c9797e6c0636dbe8fd3714a8 100644
--- a/typo3/sysext/core/Classes/Resource/ResourceFactory.php
+++ b/typo3/sysext/core/Classes/Resource/ResourceFactory.php
@@ -379,9 +379,11 @@ class ResourceFactory implements SingletonInterface
      */
     public function getStorageObjectFromCombinedIdentifier($identifier)
     {
-        $parts = GeneralUtility::trimExplode(':', $identifier);
-        $storageUid = count($parts) === 2 ? $parts[0] : null;
-        return $this->storageRepository->findByUid($storageUid);
+        [$storageId, $objectIdentifier] = array_pad(GeneralUtility::trimExplode(':', $identifier), 2, null);
+        if (!MathUtility::canBeInterpretedAsInteger($storageId) && $objectIdentifier === null) {
+            return $this->storageRepository->findByUid(0);
+        }
+        return $this->storageRepository->findByUid((int)$storageId);
     }
 
     /**
@@ -394,13 +396,19 @@ class ResourceFactory implements SingletonInterface
      */
     public function getObjectFromCombinedIdentifier($identifier)
     {
-        [$storageId, $objectIdentifier] = GeneralUtility::trimExplode(':', $identifier);
-        $storage = $this->storageRepository->findByUid($storageId);
-        if ($storage->hasFile($objectIdentifier)) {
-            return $storage->getFile($objectIdentifier);
+        [$storageId, $objectIdentifier] = array_pad(GeneralUtility::trimExplode(':', $identifier), 2, null);
+        if (!MathUtility::canBeInterpretedAsInteger($storageId) && $objectIdentifier === null) {
+            $objectIdentifier = $storageId;
+            $storageId = 0;
         }
-        if ($storage->hasFolder($objectIdentifier)) {
-            return $storage->getFolder($objectIdentifier);
+        if (MathUtility::canBeInterpretedAsInteger($storageId)) {
+            $storage = $this->storageRepository->findByUid($storageId);
+            if ($storage->hasFile($objectIdentifier)) {
+                return $storage->getFile($objectIdentifier);
+            }
+            if ($storage->hasFolder($objectIdentifier)) {
+                return $storage->getFolder($objectIdentifier);
+            }
         }
         throw new ResourceDoesNotExistException('Object with identifier "' . $identifier . '" does not exist in storage', 1329647780);
     }