Skip to content

Commit 337cbab

Browse files
authored
Add "txt" to the list of safe file extensions (#649)
so that text files will not have a duplicate extra extension
1 parent 7e55fb3 commit 337cbab

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/FileUtility.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ public static function makeSafeFilename($filename)
189189
/*
190190
if (!preg_match("/(?i)\.(pdf|docx?|rtf|odt?g?|txt|wpd|jpe?g|png|csv|xlsx?|ppt|msg|heic|tiff?|html?|bmp|wps|xps)$/i", $fileExtension))
191191
*/
192-
$GoodFileExtensions = array('bmp', 'csv', 'doc', 'docx', 'heic', 'html', 'jpeg', 'jpg', 'msg', 'odg', 'odt', 'pages', 'pdf', 'png', 'ppt', 'pptx', 'rtf', 'tiff', 'wpd', 'wps', 'xls', 'xlsx', 'bak', 'xps');
192+
$GoodFileExtensions = array('bak', 'bmp', 'csv', 'doc', 'docx', 'heic', 'html', 'jpeg', 'jpg', 'msg', 'odg', 'odt', 'pages', 'pdf', 'png', 'ppt', 'pptx', 'rtf', 'tiff', 'txt', 'wpd', 'wps', 'xls', 'xlsx', 'xps');
193193
if (!in_array($fileExtension, $GoodFileExtensions))
194194
{
195195
$filename .= ".txt";

0 commit comments

Comments
 (0)