You are here

public static function FileValidator::validateFilePathLength in Mini site 8

Validate that full file path is under allowed characters length.

Parameters

string $path: The file path to validate.

Throws

\Drupal\minisite\Exception\InvalidPathLengthValidatorException If file path length is above the allowed limit.

1 call to FileValidator::validateFilePathLength()
ArchiveValidator::validate in src/ArchiveValidator.php
Validate files.

File

src/FileValidator.php, line 52

Class

FileValidator
Class FileValidator.

Namespace

Drupal\minisite

Code

public static function validateFilePathLength($path) {
  $allowed_length = 2048 - strlen('public://') - strlen(MinisiteInterface::ASSET_DIR) - 1 - 36 - 1;
  if (strlen($path) > $allowed_length) {
    throw new InvalidPathLengthValidatorException($path, $allowed_length);
  }
}