mirror of
https://github.com/filegator/filegator.git
synced 2025-08-06 08:08:01 +02:00
download_inline configuration #141
This commit is contained in:
@@ -66,12 +66,14 @@ class DownloadController
|
||||
// @codeCoverageIgnoreEnd
|
||||
});
|
||||
|
||||
$mimes = (new MimeTypes())->getMimeTypes(pathinfo($file['filename'], PATHINFO_EXTENSION));
|
||||
$extension = pathinfo($file['filename'], PATHINFO_EXTENSION);
|
||||
$mimes = (new MimeTypes())->getMimeTypes($extension);
|
||||
$contentType = !empty($mimes) ? $mimes[0] : 'application/octet-stream';
|
||||
|
||||
$disposition = HeaderUtils::DISPOSITION_ATTACHMENT;
|
||||
|
||||
if ($contentType == 'application/pdf') {
|
||||
$download_inline = (array)$this->config->get('download_inline', ['pdf']);
|
||||
if (in_array($extension, $download_inline) || in_array('*', $download_inline)) {
|
||||
$disposition = HeaderUtils::DISPOSITION_INLINE;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user