public function FileTransfer::sanitizePath in Drupal 10
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/FileTransfer/FileTransfer.php \Drupal\Core\FileTransfer\FileTransfer::sanitizePath()
- 9 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 254
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;
}