浏览代码

Merge pull request #3344 from pixelfed/staging

Staging
daniel 3 年之前
父节点
当前提交
00ddc40c9b
共有 2 个文件被更改,包括 7 次插入0 次删除
  1. 1 0
      CHANGELOG.md
  2. 6 0
      app/Media.php

+ 1 - 0
CHANGELOG.md

@@ -114,6 +114,7 @@
 - Updated ApiV1Controller, remove no-preview image from media urls. ([37dfb101](https://github.com/pixelfed/pixelfed/commit/37dfb101))
 - Updated DeleteAccountPipeline, fix perf issues. ([a9edd93f](https://github.com/pixelfed/pixelfed/commit/a9edd93f))
 - Updated DeleteAccountPipeline, improve coverage. ([4870cc3b](https://github.com/pixelfed/pixelfed/commit/4870cc3b))
+- Updated media model, use original photo url for non-existent thumbnails. ([9b04b9d8](https://github.com/pixelfed/pixelfed/commit/9b04b9d8))
 -  ([](https://github.com/pixelfed/pixelfed/commit/))
 
 ## [v0.11.2 (2022-01-09)](https://github.com/pixelfed/pixelfed/compare/v0.11.1...v0.11.2)

+ 6 - 0
app/Media.php

@@ -55,6 +55,12 @@ class Media extends Model
             return url(Storage::url($this->thumbnail_path));
         }
 
+        if($this->media_path && $this->mime && in_array($this->mime, ['image/jpeg', 'image/png'])) {
+        	return $this->remote_media || Str::startsWith($this->media_path, 'http') ?
+                $this->media_path :
+                url(Storage::url($this->media_path));
+        }
+
         return url(Storage::url('public/no-preview.png'));
     }