+ ->willReturnCallback(function ($path, Request $request) {
+ if (strpos($path, '/system/files/') === 0 && !$request->query->has('file')) {
+ // Private files paths are split by the inbound path processor and the
+ // relative file path is moved to the 'file' query string parameter.
+ // This is because the route system does not allow an arbitrary amount
+ // of parameters.
+ // @see \Drupal\system\PathProcessor\PathProcessorFiles::processInbound()
+ $path = '/system/files';
+ }
+ return $path;
+ });