From fdd10a29f1810da8ce6febd27f05ab71add1ac7a Mon Sep 17 00:00:00 2001 From: Bastard Operator Date: Mon, 12 Oct 2020 22:50:58 +0200 Subject: [PATCH] Added support for mastodon images --- imgproxy/index.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/imgproxy/index.php b/imgproxy/index.php index cd02d64..8cd1801 100644 --- a/imgproxy/index.php +++ b/imgproxy/index.php @@ -3,7 +3,8 @@ $url = trim($_GET['url']); # check url matches a https://domain/storage/whatever.jpeg url for images -if (preg_match('/^https:\/\/[^\/]+\/storage\/[^\s\%]+\.(png|jpg|jpeg)(\?v=[^\&])?$/', $url)) { +if (preg_match('/^https:\/\/[^\/]+\/storage\/[^\s\%]+\.(png|jpg|jpeg)(\?v=[^\&])?$/', $url) || + preg_match('/^https:\/\/[^\/]+\/system\/media_attachments\/[^\s\%]+\.(png|jpg|jpeg)(\?v=[^\&])?$/', $url)) { if (preg_match('/^.*\.png(\?v=[^\&])?$/', $url)) header('Content-Type: image/png'); else if (preg_match('/^.*\.(jpg|jpeg)(\?v=[^\&])?$/', $url))