s3 bandwidth usage fix

This commit is contained in:
Čarodej
2022-03-29 10:06:20 +02:00
parent 8c59501907
commit 9d4d1ba9aa
28 changed files with 205 additions and 214 deletions

View File

@@ -33,7 +33,7 @@ class Kernel extends ConsoleKernel
*/
protected function schedule(Schedule $schedule): void
{
if (! is_storage_driver('local')) {
if (! isStorageDriver('local')) {
$schedule->call(
fn () => resolve(DeleteFailedFilesAction::class)()
)->everySixHours();

View File

@@ -1,9 +1,9 @@
<?php
namespace App\Users\Controllers;
use Illuminate\Http\Response;
use Illuminate\Support\Facades\Storage;
use Symfony\Component\HttpFoundation\StreamedResponse;
use Illuminate\Contracts\Filesystem\FileNotFoundException;
class GetAvatarController
{
@@ -12,10 +12,10 @@ class GetAvatarController
*/
public function __invoke(
string $basename
): StreamedResponse | FileNotFoundException {
): StreamedResponse | Response {
// Check if file exist
if (! Storage::exists("/avatars/$basename")) {
abort(404);
return response('File not found', 404);
}
// Return avatar

View File

@@ -42,7 +42,7 @@ class UserSetting extends Model
$link = [];
// Get avatar from external storage
if ($this->attributes['avatar'] && ! is_storage_driver('local')) {
if ($this->attributes['avatar'] && ! isStorageDriver('local')) {
foreach (config('vuefilemanager.avatar_sizes') as $item) {
$filePath = "avatars/{$item['name']}-{$this->attributes['avatar']}";