Update Profile model, fix avatar url path generation. Fixes #4041, Fixes #4031, Fixes #3523

This commit is contained in:
Daniel Supernault 2023-04-04 02:35:37 -06:00
parent 22da2647c7
commit 28bf8649b3
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -178,13 +178,21 @@ class Profile extends Model
return url('/storage/avatars/default.jpg'); return url('/storage/avatars/default.jpg');
} }
if($path === 'public/avatars/default.jpg') {
return url('/storage/avatars/default.jpg');
}
if(substr($path, 0, 6) !== 'public') { if(substr($path, 0, 6) !== 'public') {
return url('/storage/avatars/default.jpg'); return url('/storage/avatars/default.jpg');
} }
if(config('filesystems.default') !== 'local') {
return Storage::url($path);
}
$path = "{$path}?v={$avatar->change_count}"; $path = "{$path}?v={$avatar->change_count}";
return config('app.url') . Storage::url($path); return url(Storage::url($path));
}); });
return $url; return $url;