Allow File instance to be passed to BinaryFileResponse
This commit is contained in:
parent
37a4876d8b
commit
fc04ad2134
@ -81,7 +81,9 @@ class BinaryFileResponse extends Response
|
|||||||
*/
|
*/
|
||||||
public function setFile($file, $contentDisposition = null, $autoEtag = false, $autoLastModified = true)
|
public function setFile($file, $contentDisposition = null, $autoEtag = false, $autoLastModified = true)
|
||||||
{
|
{
|
||||||
$file = new File((string) $file);
|
if (!$file instanceof File) {
|
||||||
|
$file = new File((string) $file);
|
||||||
|
}
|
||||||
|
|
||||||
if (!$file->isReadable()) {
|
if (!$file->isReadable()) {
|
||||||
throw new FileException('File must be readable.');
|
throw new FileException('File must be readable.');
|
||||||
|
Reference in New Issue
Block a user