Issue #3032620 by alexpott, dww: \Drupal\file\Plugin\rest\resource\FileUploadResource uses basename() when it needs to use the Drupal version
parent
5d2bc24951
commit
e1ec253590
|
|
@ -377,7 +377,7 @@ class FileUploadResource extends ResourceBase {
|
||||||
|
|
||||||
// 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 @@ abstract class FileUploadResourceTestBase extends ResourceTestBase {
|
||||||
|
|
||||||
$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'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue