From 9163bc24e9f82ccd594e8ac6689099a720f91904 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Wed, 9 Oct 2019 15:19:47 +0900 Subject: [PATCH] =?UTF-8?q?=EA=B8=B0=EC=A1=B4=EC=97=90=20direct=20download?= =?UTF-8?q?=EA=B0=80=20=ED=97=88=EC=9A=A9=EB=90=98=EB=8D=98=20=ED=83=80?= =?UTF-8?q?=EC=9E=85=EC=9D=84=20=EB=B3=B5=EC=9B=90=ED=95=98=EB=90=98,=20?= =?UTF-8?q?=EB=A0=88=EA=B1=B0=EC=8B=9C=20=ED=83=80=EC=9E=85=EC=9D=80=20?= =?UTF-8?q?=EB=B3=84=EB=8F=84=20=ED=91=9C=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/framework/filters/filenamefilter.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/common/framework/filters/filenamefilter.php b/common/framework/filters/filenamefilter.php index 59a4b55b5..1505983f0 100644 --- a/common/framework/filters/filenamefilter.php +++ b/common/framework/filters/filenamefilter.php @@ -97,7 +97,12 @@ class FilenameFilter */ public static function isDirectDownload($filename) { - if (preg_match('/\.(gif|jpe?g|png|webp|mp3|wav|ogg|flac|aac|mp4|webm|ogv)$/i', $filename)) + $images = 'gif|jpe?g|png|webp'; + $audios = 'mp3|wav|ogg|flac|aac'; + $videos = 'mp4|webm|ogv'; + $legacy = 'avi|as[fx]|flv|m4[av]|midi?|mkv|moo?v|mpe?g|qt|r[am]m?|wm[av]'; + + if (preg_match(sprintf('/\.(?:%s|%s|%s|%s)$/i', $images, $audios, $videos, $legacy), $filename)) { return true; }