Fixes for protected download streams

This commit is contained in:
David Bomba 2023-07-10 18:36:42 +10:00
parent d522b75d41
commit 6a2600b7dc
2 changed files with 2 additions and 7 deletions

View File

@ -30,12 +30,7 @@ class ProtectedDownloadController extends BaseController
abort(404, 'File no longer available');
}
UnlinkFile::dispatch(config('filesystems.default'), $hashed_path)->delay(now()->addSeconds(10));
return response()->streamDownload(function () use ($hashed_path) {
echo Storage::get($hashed_path);
}, basename($hashed_path), []);
return response()->download($hashed_path, basename($hashed_path), [])->deleteFileAfterSend(true);
}

View File

@ -126,7 +126,7 @@ class Helpers
return $custom_field_parts[0];
}
$field = str_replace(["quote","credit"], ["invoice","invoice"], $field);
$field = str_replace(["quote","credit"], ["invoice", "invoice"], $field);
if ($custom_fields && property_exists($custom_fields, $field)) {
$custom_field = $custom_fields->{$field};