function NameMungingTest::testMungeIgnoreInsecure

Same name in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/File/NameMungingTest.php \Drupal\KernelTests\Core\File\NameMungingTest::testMungeIgnoreInsecure()

If the system.file.allow_insecure_uploads setting evaluates to true, the file should come out untouched, no matter how evil the filename.

File

core/tests/Drupal/KernelTests/Core/File/NameMungingTest.php, line 85

Class

NameMungingTest
Tests filename munging and unmunging.

Namespace

Drupal\KernelTests\Core\File

Code

public function testMungeIgnoreInsecure() {
    $this->config('system.file')
        ->set('allow_insecure_uploads', 1)
        ->save();
    $munged_name = file_munge_filename($this->name, '');
    $this->assertSame($munged_name, $this->name, new FormattableMarkup('The original filename (%original) matches the munged filename (%munged) when insecure uploads are enabled.', [
        '%munged' => $munged_name,
        '%original' => $this->name,
    ]));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.