mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-11 05:47:28 -08:00
Conditionally add content-type
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
017884f843
commit
c01190fac2
|
@ -132,15 +132,19 @@ class UserFilesController extends Controller
|
|||
$file = 'private_uploads/users/'.$log->filename;
|
||||
|
||||
|
||||
if ((request('inline') == 'true') && (StorageHelper::allowSafeInline($file) === false)) {
|
||||
|
||||
// Display the file as text is not allowed for security reasons
|
||||
if (request('inline') == 'true') {
|
||||
|
||||
$headers = [
|
||||
'Content-Disposition' => 'inline',
|
||||
'Content-Type' => 'text/plain',
|
||||
];
|
||||
return Storage::download($file, $log->filename, $headers);
|
||||
|
||||
// This is NOT allowed as inline - force it to be displayed as text
|
||||
if (StorageHelper::allowSafeInline($file) === false) {
|
||||
array_push($headers, ['Content-Type' => 'text/plain']);
|
||||
}
|
||||
|
||||
return Storage::download($file, $log->filename, $headers);
|
||||
}
|
||||
|
||||
return Storage::download($file);
|
||||
|
|
Loading…
Reference in a new issue