Skip deleting default avatar from disk on delete

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2024-07-20 01:01:27 +01:00
parent ca7c0aa47c
commit e373be7dde

View file

@ -455,8 +455,9 @@ class SettingsController extends Controller
// Default avatar upload // Default avatar upload
$setting = $request->handleImages($setting, 500, 'default_avatar', 'avatars', 'default_avatar'); $setting = $request->handleImages($setting, 500, 'default_avatar', 'avatars', 'default_avatar');
if ($request->input('clear_default_avatar') == '1') { if (($request->input('clear_default_avatar') == '1') && ($setting->default_avatar!='default.png')) {
\Log::debug('Deleting default avatar');
if (($setting->default_avatar) && (Storage::exists('avatars/'.$setting->default_avatar))) { if (($setting->default_avatar) && (Storage::exists('avatars/'.$setting->default_avatar))) {
Storage::disk('public')->delete('avatars/'.$setting->default_avatar); Storage::disk('public')->delete('avatars/'.$setting->default_avatar);
} }