From 1f22c3f4c5a611efc6f15f601f4c155fb640b917 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20Fabr=C3=A9gat?= Date: Sun, 4 Mar 2018 11:12:24 +0100 Subject: [PATCH] mime lookup through hoa/Mime --- composer.json | 7 ++++--- src/FileResponse.php | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 7f88e85..ba9fafb 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "codeinchq/lib-psr7responses", - "version": "1.1.6", + "version": "1.1.7", "description": "A collection of PSR-7 responses", "homepage": "https://github.com/codeinchq/lib-psr7responses", "type": "library", @@ -9,7 +9,8 @@ "php": ">=7.1", "psr/http-message": "^1.0", "guzzlehttp/psr7": "^1.4", - "codeinchq/lib-errordisplay": "^1.1" + "codeinchq/lib-errordisplay": "^1.1", + "hoa/mime": "3.17.01.10" }, "require-dev": { "phpunit/phpunit": "^7" @@ -36,4 +37,4 @@ "*": "dist" } } -} \ No newline at end of file +} diff --git a/src/FileResponse.php b/src/FileResponse.php index 289dfc3..7ae06e4 100644 --- a/src/FileResponse.php +++ b/src/FileResponse.php @@ -21,6 +21,7 @@ // declare(strict_types = 1); namespace CodeInc\Psr7Responses; +use Hoa\Mime\Mime; /** @@ -62,7 +63,7 @@ public function __construct(string $filePath, ?string $fileName = null, ?string parent::__construct( $f, - $mimeType ?? mime_content_type($filePath), + $mimeType ?? Mime::getMimeFromExtension($filePath), filesize($filePath) ?: null, $fileName ?? basename($filePath), $asAttachment,