From 672f7c8ce082ac82c01ce4ce59d8e4777dffdcdf Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sat, 16 Jul 2022 02:47:05 -0600 Subject: [PATCH 1/2] Fix remote avatar urls when not using cloud storage --- app/Profile.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/Profile.php b/app/Profile.php index dedc2739f..491606031 100644 --- a/app/Profile.php +++ b/app/Profile.php @@ -157,15 +157,19 @@ class Profile extends Model public function avatarUrl() { - $url = Cache::remember('avatar:'.$this->id, now()->addYears(1), function () { + $url = Cache::remember('avatar:'.$this->id, 1209600, function () { $avatar = $this->avatar; if($avatar->cdn_url) { - return $avatar->cdn_url ?? url('/storage/avatars/default.jpg'); + if(substr($avatar->cdn_url, 0, 8) === 'https://') { + return $avatar->cdn_url; + } else { + return url($avatar->cdn_url); + } } if($avatar->is_remote) { - return $avatar->cdn_url ?? url('/storage/avatars/default.jpg'); + return url('/storage/avatars/default.jpg'); } $path = $avatar->media_path; From 913a7923c65ba8f79478796e7e9c879fb2200f55 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sat, 16 Jul 2022 02:47:31 -0600 Subject: [PATCH 2/2] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cb491c957..0edab964e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,6 +40,7 @@ - Improve inbox status deletion cache invalidation ([1eba7f81](https://github.com/pixelfed/pixelfed/commit/1eba7f81)) - Update MediaDeletePipeline, fix async media deletion ([bb1cccbe](https://github.com/pixelfed/pixelfed/commit/bb1cccbe)) - Fix timeline infinite scroll ([03a85460](https://github.com/pixelfed/pixelfed/commit/03a85460)) +- Fix remote avatar urls when not using cloud storage ([672f7c8c](https://github.com/pixelfed/pixelfed/commit/672f7c8c)) - ([](https://github.com/pixelfed/pixelfed/commit/)) ## [v0.11.3 (2022-05-09)](https://github.com/pixelfed/pixelfed/compare/v0.11.2...v0.11.3)