Skip to content

A free open source IT asset/license management system

Actually force the download in S3

snipe3b875ce6ecb4
diff --git a/app/Helpers/StorageHelper.php b/app/Helpers/StorageHelper.php
index 477e57c214..3fcbb4d80b 100644
--- a/app/Helpers/StorageHelper.php
+++ b/app/Helpers/StorageHelper.php
@@ -2,7 +2,6 @@
namespace App\Helpers;
-use Illuminate\Contracts\Filesystem\FileNotFoundException;
use Illuminate\Http\RedirectResponse;
use Illuminate\Support\Facades\Storage;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
@@ -20,7 +19,14 @@ class StorageHelper
return response()->download(Storage::disk($disk)->path($filename)); // works for PRIVATE or public?!
case 's3':
- return redirect()->away(Storage::disk($disk)->temporaryUrl($filename, now()->addMinutes(5))); // works for private or public, I guess?
+ Storage::disk($disk)->temporaryUrl(
+ $filename,
+ now()->addMinutes(5),
+ [
+ 'ResponseContentType' => 'application/octet-stream',
+ 'ResponseContentDisposition' => 'attachment; filename=download-file',
+ ]
+ );
default:
return Storage::disk($disk)->download($filename);
@@ -119,5 +125,4 @@ class StorageHelper
return null;
}
-
}