|
@@ -9,7 +9,6 @@ class MediaController extends Controller
|
|
{
|
|
{
|
|
public function index(Request $request)
|
|
public function index(Request $request)
|
|
{
|
|
{
|
|
- //return view('settings.drive.index');
|
|
|
|
abort(404);
|
|
abort(404);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -20,13 +19,21 @@ class MediaController extends Controller
|
|
|
|
|
|
public function fallbackRedirect(Request $request, $pid, $mhash, $uhash, $f)
|
|
public function fallbackRedirect(Request $request, $pid, $mhash, $uhash, $f)
|
|
{
|
|
{
|
|
- abort_if(! (bool) config_cache('pixelfed.cloud_storage'), 404);
|
|
|
|
|
|
+ if (! (bool) config_cache('pixelfed.cloud_storage')) {
|
|
|
|
+ return redirect('/storage/no-preview.png', 302);
|
|
|
|
+ }
|
|
|
|
+
|
|
$path = 'public/m/_v2/'.$pid.'/'.$mhash.'/'.$uhash.'/'.$f;
|
|
$path = 'public/m/_v2/'.$pid.'/'.$mhash.'/'.$uhash.'/'.$f;
|
|
|
|
+
|
|
$media = Media::whereProfileId($pid)
|
|
$media = Media::whereProfileId($pid)
|
|
->whereMediaPath($path)
|
|
->whereMediaPath($path)
|
|
->whereNotNull('cdn_url')
|
|
->whereNotNull('cdn_url')
|
|
- ->firstOrFail();
|
|
|
|
|
|
+ ->first();
|
|
|
|
+
|
|
|
|
+ if (! $media) {
|
|
|
|
+ return redirect('/storage/no-preview.png', 302);
|
|
|
|
+ }
|
|
|
|
|
|
- return redirect()->away($media->cdn_url);
|
|
|
|
|
|
+ return redirect()->away($media->cdn_url, 302);
|
|
}
|
|
}
|
|
}
|
|
}
|