private function getDefaultExtFromSite($pathinfo, $extension = null, Site $site = null)
    {
        if (strpos(basename($pathinfo), '.') || '/' === substr($pathinfo, -1)) {
            return $pathinfo;
        }

        $siteUsed = $this->getCurrentSite($site);
        $addExtension = $extension;
        if (null === $addExtension && null !== $siteUsed) {
            $addExtension = $siteUsed->getDefaultExtension();
        }

        return $pathinfo.$addExtension;
    }