You are here

public function PathProcessorFiles::processInbound in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/system/src/PathProcessor/PathProcessorFiles.php \Drupal\system\PathProcessor\PathProcessorFiles::processInbound()

Processes the inbound path.

Parameters

string $path: The path to process, with a leading slash.

\Symfony\Component\HttpFoundation\Request $request: The HttpRequest object representing the current request.

Return value

string The processed path.

Overrides InboundPathProcessorInterface::processInbound

File

core/modules/system/src/PathProcessor/PathProcessorFiles.php, line 24
Contains \Drupal\system\PathProcessor\PathProcessorFiles.

Class

PathProcessorFiles
Defines a path processor to rewrite file URLs.

Namespace

Drupal\system\PathProcessor

Code

public function processInbound($path, Request $request) {
  if (strpos($path, '/system/files/') === 0 && !$request->query
    ->has('file')) {
    $file_path = preg_replace('|^\\/system\\/files\\/|', '', $path);
    $request->query
      ->set('file', $file_path);
    return '/system/files';
  }
  return $path;
}