- S3 storages compatibility with v2

- user profile fixes
This commit is contained in:
Peter Papp
2021-04-06 18:01:59 +02:00
parent e40ddbec14
commit bf9581173c
39 changed files with 124 additions and 129 deletions
+2 -2
View File
@@ -104,7 +104,7 @@ class File extends Model
// Get thumbnail from external storage
if ($this->attributes['thumbnail'] && ! is_storage_driver(['local'])) {
return Storage::temporaryUrl('files/' . $this->attributes['thumbnail'], now()->addHour());
return Storage::temporaryUrl("files/$this->user_id/{$this->attributes['thumbnail']}", now()->addHour());
}
// Get thumbnail from local storage
@@ -145,7 +145,7 @@ class File extends Model
'ResponseContentDisposition' => 'attachment; filename=' . $file_pretty_name,
];
return Storage::temporaryUrl('files/' . $this->attributes['basename'], now()->addDay(), $header);
return Storage::temporaryUrl("files/$this->user_id/{$this->attributes['basename']}", now()->addDay(), $header);
}
// Get thumbnail from local storage
+2 -2
View File
@@ -22,7 +22,7 @@ class UserSettings extends Model
public function getAvatarAttribute()
{
// Get avatar from external storage
if ($this->attributes['avatar'] && is_storage_driver(['s3', 'spaces', 'wasabi', 'backblaze'])) {
if ($this->attributes['avatar'] && ! is_storage_driver('local')) {
return Storage::temporaryUrl($this->attributes['avatar'], now()->addDay());
}
@@ -31,6 +31,6 @@ class UserSettings extends Model
return url('/' . $this->attributes['avatar']);
}
return url('/assets/images/' . 'default-avatar.png');
return url('/assets/images/default-avatar.png');
}
}