W3cubDocs

/Drupal 8

protected final function FileTransfer::checkPath

protected final FileTransfer::checkPath($path)

Checks that the path is inside the jail and throws an exception if not.

Parameters

string $path: A path to check against the jail.

Throws

\Drupal\Core\FileTransfer\FileTransferException

File

core/lib/Drupal/Core/FileTransfer/FileTransfer.php, line 208

Class

FileTransfer
Defines the base FileTransfer class.

Namespace

Drupal\Core\FileTransfer

Code

protected final function checkPath($path) {
  $full_jail = $this->chroot . $this->jail;
  $full_path = drupal_realpath(substr($this->chroot . $path, 0, strlen($full_jail)));
  $full_path = $this->fixRemotePath($full_path, FALSE);
  if ($full_jail !== $full_path) {
    throw new FileTransferException('@directory is outside of the @jail', NULL, array('@directory' => $path, '@jail' => $this->jail));
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!FileTransfer!FileTransfer.php/function/FileTransfer::checkPath/8.1.x