getPath(); if (!is_file($absolutePath)) { return $baseUri; } } catch (\Throwable) { // See https://review.typo3.org/75477 for the reason of this try/catch // likely we can remove this in the future, but it is kept for now to ensure BC return $baseUri; } $configAccessor = $applicationType?->isFrontend() ? 'FE' : 'BE'; $rewriteFileName = (bool)($GLOBALS['TYPO3_CONF_VARS'][$configAccessor]['versionNumberInFilename'] ?? false); $fileModificationTime = filemtime($absolutePath); if ($rewriteFileName) { $nameParts = explode('.', $baseUri->getPath()); $fileExtension = array_pop($nameParts); array_push($nameParts, $fileModificationTime, $fileExtension); $uri = $baseUri->withPath(implode('.', $nameParts)); } else { $query = $baseUri->getQuery(); $uri = $baseUri->withQuery($query . ($query !== '' ? '&' : '') . $fileModificationTime); } return $uri; } public static function fromFile(File $file, UriInterface $baseUri): UriInterface { $query = $baseUri->getQuery(); return $baseUri->withQuery($query . ($query !== '' ? '&' : '') . $file->getSha1()); } }