From 63bd6126b228452dd692d7a41b6e841e1c990d92 Mon Sep 17 00:00:00 2001 From: Ed Wilde Date: Thu, 26 Oct 2023 10:58:02 +1300 Subject: [PATCH] Add support for braille format files (#574) * Add support for braille format files * ENH Add support for braille files * ENH Add test for braille file format --- _config/filetypes.yml | 1 + src/File.php | 4 ++-- tests/php/FileTest.php | 3 +++ tests/php/FileTest.yml | 4 ++++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/_config/filetypes.yml b/_config/filetypes.yml index e37badf9..470f08a1 100644 --- a/_config/filetypes.yml +++ b/_config/filetypes.yml @@ -29,3 +29,4 @@ SilverStripe\Assets\File: html: 'HTML file' htm: 'HTML file' webp: 'WEBP Image' + brf: 'Braille ASCII file' diff --git a/src/File.php b/src/File.php index 50e01d98..068349b7 100644 --- a/src/File.php +++ b/src/File.php @@ -202,7 +202,7 @@ class File extends DataObject implements AssetContainer, Thumbnail, CMSPreviewab * Instructions for the change you need to make are included in a comment in the config file. */ private static $allowed_extensions = [ - '', 'ace', 'arc', 'arj', 'asf', 'au', 'avi', 'bmp', 'bz2', 'cab', 'cda', 'csv', 'dmg', 'doc', + '', 'ace', 'arc', 'arj', 'asf', 'au', 'avi', 'bmp', 'brf', 'bz2', 'cab', 'cda', 'csv', 'dmg', 'doc', 'docx', 'dotx', 'flv', 'gif', 'gz', 'hqx', 'ico', 'jpeg', 'jpg', 'kml', 'm4a', 'm4v', 'mid', 'midi', 'mkv', 'mov', 'mp3', 'mp4', 'mpa', 'mpeg', 'mpg', 'ogg', 'ogv', 'pages', 'pcx', 'pdf', 'png', 'pps', 'ppt', 'pptx', 'potx', 'ra', 'ram', 'rm', 'rtf', 'sit', 'sitx', @@ -224,7 +224,7 @@ class File extends DataObject implements AssetContainer, Thumbnail, CMSPreviewab 'ram', 'rm', 'snd', 'wav', 'wma', ], 'document' => [ - 'css', 'csv', 'doc', 'docx', 'dotm', 'dotx', 'htm', 'html', 'js', 'kml', 'pages', 'pdf', + 'brf', 'css', 'csv', 'doc', 'docx', 'dotm', 'dotx', 'htm', 'html', 'js', 'kml', 'pages', 'pdf', 'potm', 'potx', 'pps', 'ppt', 'pptx', 'rtf', 'txt', 'xhtml', 'xls', 'xlsx', 'xltm', 'xltx', 'xml', ], 'image' => [ diff --git a/tests/php/FileTest.php b/tests/php/FileTest.php index 33726249..52d5f548 100644 --- a/tests/php/FileTest.php +++ b/tests/php/FileTest.php @@ -477,6 +477,9 @@ public function testFileType() $file = $this->objFromFixture(Image::class, 'gif'); $this->assertEquals("GIF image - good for diagrams", $file->getFileType()); + $file = $this->objFromFixture(File::class, 'brf'); + $this->assertEquals("Braille ASCII file", $file->getFileType()); + $file = $this->objFromFixture(File::class, 'pdf'); $this->assertEquals("Adobe Acrobat PDF file", $file->getFileType()); diff --git a/tests/php/FileTest.yml b/tests/php/FileTest.yml index 5c9ca57e..9584aef1 100644 --- a/tests/php/FileTest.yml +++ b/tests/php/FileTest.yml @@ -113,6 +113,10 @@ SilverStripe\Assets\File: FileFilename: FileTest.txt FileHash: 55b443b60176235ef09801153cca4e6da7494a0c Name: FileTest.txt + brf: + FileFilename: FileTest.brf + FileHash: 55b443b60176235ef09801153cca4e6da7494a0c + Name: FileTest.brf pdf: FileFilename: FileTest.pdf FileHash: 55b443b60176235ef09801153cca4e6da7494a0c