Skip to content

Commit

Permalink
Add support for braille format files (#574)
Browse files Browse the repository at this point in the history
* Add support for braille format files

* ENH Add support for braille files

* ENH Add test for braille file format
  • Loading branch information
edwilde authored Oct 25, 2023
1 parent 27000f1 commit 63bd612
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions _config/filetypes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ SilverStripe\Assets\File:
html: 'HTML file'
htm: 'HTML file'
webp: 'WEBP Image'
brf: 'Braille ASCII file'
4 changes: 2 additions & 2 deletions src/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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' => [
Expand Down
3 changes: 3 additions & 0 deletions tests/php/FileTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand Down
4 changes: 4 additions & 0 deletions tests/php/FileTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 63bd612

Please sign in to comment.