code: public function sanitizeFileName($fileName, \TYPO3\CMS\Core\Resource\Folder $folder)
      {
          $slotArguments = func_get_args();
          // Last parameter is the signal name itself and is not actually part of the arguments
          array_pop($slotArguments);
  
          $storageConfiguration = $folder->getStorage()->getConfiguration();
          $storageRecord = $folder->getStorage()->getStorageRecord();
          if ($storageRecord['driver'] !== 'Local') {
              // Unfortunately unsupported yet
              return;
          }
  
          $targetDirectory = $storageConfiguration['pathType'] === 'relative' ? PATH_site : '';
          $targetDirectory .= rtrim(rtrim($storageConfiguration['basePath'], '/') . $folder->getIdentifier(), '/');
  
          $processedFileName = static::$imageResizer->getProcessedFileName(
              $targetDirectory . '/' . $fileName,
              $GLOBALS['BE_USER']
          );
          if ($processedFileName !== null) {
              static::$originalFileName = $fileName;
              $slotArguments[0] = PathUtility::basename($processedFileName);
  
              return $slotArguments;
          }
      }
docs: Sanitizes the file name.
  
  @param string $fileName
  @param \TYPO3\CMS\Core\Resource\Folder $folder
  @return void|array