From 405cbc09ba3847042d6b21bb7fc898e83772cc09 Mon Sep 17 00:00:00 2001 From: Jake Dallimore Date: Tue, 12 Sep 2017 08:32:45 +0800 Subject: [PATCH] MDL-59507 forms: accepted file types won't allow the .xxx extension - Modified get_filetypes_browser_data() to exclude this extension. - Server side form validation blocks this extension too. --- lib/form/classes/filetypes_util.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/form/classes/filetypes_util.php b/lib/form/classes/filetypes_util.php index 4bebfd577b1..2dcbe2b894f 100644 --- a/lib/form/classes/filetypes_util.php +++ b/lib/form/classes/filetypes_util.php @@ -323,6 +323,10 @@ class filetypes_util { $others = []; foreach (core_filetypes::get_types() as $extension => $info) { + // Reserved for unknown file types. Not available here. + if ($extension === 'xxx') { + continue; + } $extension = '.'.$extension; if ($onlytypes && !$this->is_whitelisted($extension, $onlytypes)) { continue; @@ -496,6 +500,8 @@ class filetypes_util { if ($type === '*') { // Any file is considered as a known type. continue; + } else if ($type === '.xxx') { + $unknown[$type] = true; } else if ($this->is_filetype_group($type)) { // The type is a group that exists. continue;