Issue #3032620 by alexpott, dww: \Drupal\file\Plugin\rest\resource\FileUploadResource uses basename() when it needs to use the Drupal version

8.7.x
Lee Rowlands 2019-02-25 20:35:03 +10:00
parent 5d2bc24951
commit e1ec253590
No known key found for this signature in database
GPG Key ID: 2B829A3DF9204DC4
2 changed files with 6 additions and 4 deletions

View File

@ -377,7 +377,7 @@ class FileUploadResource extends ResourceBase {
// Make sure only the filename component is returned. Path information is
// stripped as per https://tools.ietf.org/html/rfc6266#section-4.3.
return basename($filename);
return $this->fileSystem->basename($filename);
}
/**

View File

@ -373,11 +373,13 @@ abstract class FileUploadResourceTestBase extends ResourceTestBase {
$uri = Url::fromUri('base:' . static::$postUri);
$response = $this->fileRequest($uri, $this->testFileData, ['Content-Disposition' => 'file; filename="example-✓.txt"']);
// It is important that the filename starts with a unicode character. See
// https://bugs.php.net/bug.php?id=77239.
$response = $this->fileRequest($uri, $this->testFileData, ['Content-Disposition' => 'file; filename="Èxample-✓.txt"']);
$this->assertSame(201, $response->getStatusCode());
$expected = $this->getExpectedNormalizedEntity(1, 'example-✓.txt', TRUE);
$expected = $this->getExpectedNormalizedEntity(1, 'Èxample-✓.txt', TRUE);
$this->assertResponseData($expected, $response);
$this->assertSame($this->testFileData, file_get_contents('public://foobar/example-✓.txt'));
$this->assertSame($this->testFileData, file_get_contents('public://foobar/Èxample-✓.txt'));
}
/**