Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. FileTransfer.php

function FileTransfer::sanitizePath

Changes backslashes to slashes, also removes a trailing slash.

Parameters

string $path: The path to modify.

Return value

string The modified path.

4 calls to FileTransfer::sanitizePath()
FileTransfer::chmod in core/lib/Drupal/Core/FileTransfer/FileTransfer.php
Changes the permissions of the specified $path (file or directory).
FileTransfer::copyDirectory in core/lib/Drupal/Core/FileTransfer/FileTransfer.php
Copies a directory.
FileTransfer::copyFile in core/lib/Drupal/Core/FileTransfer/FileTransfer.php
Copies a file.
FileTransfer::fixRemotePath in core/lib/Drupal/Core/FileTransfer/FileTransfer.php
Returns a modified path suitable for passing to the server.

File

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

Class

FileTransfer
Defines the base FileTransfer class.

Namespace

Drupal\Core\FileTransfer

Code

public function sanitizePath($path) {
    // Windows path sanitization.
    $path = str_replace('\\', '/', $path);
    if (str_ends_with($path, '/')) {
        $path = substr($path, 0, -1);
    }
    return $path;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal