Commit e1ec2535 authored by larowlan's avatar larowlan

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
...@@ -377,7 +377,7 @@ protected function validateAndParseContentDispositionHeader(Request $request) { ...@@ -377,7 +377,7 @@ protected function validateAndParseContentDispositionHeader(Request $request) {
// Make sure only the filename component is returned. Path information is // Make sure only the filename component is returned. Path information is
// stripped as per https://tools.ietf.org/html/rfc6266#section-4.3. // 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() { ...@@ -373,11 +373,13 @@ public function testFileUploadUnicodeFilename() {
$uri = Url::fromUri('base:' . static::$postUri); $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()); $this->assertSame(201, $response->getStatusCode());
$expected = $this->getExpectedNormalizedEntity(1, 'example-✓.txt', TRUE); $expected = $this->getExpectedNormalizedEntity(1, 'Èxample-✓.txt', TRUE);
$this->assertResponseData($expected, $response); $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'));
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment