Skip to content
Snippets Groups Projects
Verified Commit e1ec2535 authored by Lee Rowlands's avatar Lee Rowlands
Browse files

Issue #3032620 by alexpott, dww:...

Issue #3032620 by alexpott, dww: \Drupal\file\Plugin\rest\resource\FileUploadResource uses basename() when it needs to use the Drupal version
parent 5d2bc249
No related branches found
No related tags found
No related merge requests found
......@@ -377,7 +377,7 @@ protected function validateAndParseContentDispositionHeader(Request $request) {
// 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);
}
/**
......
......@@ -373,11 +373,13 @@ public function testFileUploadUnicodeFilename() {
$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'));
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment