function FileTransfer::sanitizePath
Same name and namespace in other branches
- 11.x core/lib/Drupal/Core/FileTransfer/FileTransfer.php \Drupal\Core\FileTransfer\FileTransfer::sanitizePath()
- 7.x includes/filetransfer/filetransfer.inc \FileTransfer::sanitizePath()
- 10 core/lib/Drupal/Core/FileTransfer/FileTransfer.php \Drupal\Core\FileTransfer\FileTransfer::sanitizePath()
- 8.9.x core/lib/Drupal/Core/FileTransfer/FileTransfer.php \Drupal\Core\FileTransfer\FileTransfer::sanitizePath()
Changes backslashes to slashes, also removes a trailing slash.
Parameters
string $path: The path to modify.
Return value
string The modified path.
File
-
core/
lib/ Drupal/ Core/ FileTransfer/ FileTransfer.php, line 312
Class
- FileTransfer
- Defines the base FileTransfer class.
Namespace
Drupal\Core\FileTransferCode
public function sanitizePath($path) {
// Windows path sanitization.
$path = str_replace('\\', '/', $path);
if (substr($path, -1) == '/') {
$path = substr($path, 0, -1);
}
return $path;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.