diff --git a/src/Assets/Asset.php b/src/Assets/Asset.php index 1ac0766f30b..a432150acbb 100644 --- a/src/Assets/Asset.php +++ b/src/Assets/Asset.php @@ -68,7 +68,7 @@ class Asset implements Arrayable, ArrayAccess, AssetContract, Augmentable, Conta const AUDIO_EXTENSIONS = ['aac', 'flac', 'm4a', 'mp3', 'ogg', 'wav']; const IMAGE_EXTENSIONS = ['jpg', 'jpeg', 'png', 'gif', 'webp', 'avif']; - const VIDEO_EXTENSIONS = ['h264', 'mp4', 'm4v', 'ogv', 'webm', 'mov']; + const VIDEO_EXTENSIONS = ['h264', 'mp4', 'm4v', 'ogv', 'webm', 'mov', 'mpeg', 'mpg', 'mkv']; protected $container; protected $path; diff --git a/src/Rules/AllowedFile.php b/src/Rules/AllowedFile.php index 8f361ad783d..f63b1f76023 100644 --- a/src/Rules/AllowedFile.php +++ b/src/Rules/AllowedFile.php @@ -10,6 +10,7 @@ class AllowedFile implements ValidationRule { private const EXTENSIONS = [ '7z', + 'aac', 'aiff', 'asc', 'asf', @@ -25,10 +26,12 @@ class AllowedFile implements ValidationRule 'dotm', 'dotx', 'fla', + 'flac', 'flv', 'gif', 'gz', 'gzip', + 'h264', 'heic', 'heif', 'hevc', @@ -46,6 +49,7 @@ class AllowedFile implements ValidationRule 'mcc', 'md', 'mid', + 'mkv', 'mov', 'mp3', 'mp4', diff --git a/src/Support/FileTypes.php b/src/Support/FileTypes.php index dacf0752e84..f56cd934225 100644 --- a/src/Support/FileTypes.php +++ b/src/Support/FileTypes.php @@ -2,6 +2,8 @@ namespace Statamic\Support; +use Statamic\Assets\Asset; + class FileTypes { public static function media(): array @@ -23,7 +25,7 @@ public static function image(): array public static function rasterImage(): array { - return ['jpg', 'jpeg', 'png', 'gif', 'webp', 'avif']; + return Asset::IMAGE_EXTENSIONS; } public static function vectorImage(): array @@ -33,12 +35,12 @@ public static function vectorImage(): array public static function video(): array { - return ['h264', 'mp4', 'm4v', 'ogv', 'webm', 'mov']; + return Asset::VIDEO_EXTENSIONS; } public static function audio(): array { - return ['aac', 'flac', 'm4a', 'mp3', 'ogg', 'wav']; + return Asset::AUDIO_EXTENSIONS; } public static function document(): array diff --git a/tests/Assets/AssetTest.php b/tests/Assets/AssetTest.php index d19d750e5b1..9e2733134c1 100644 --- a/tests/Assets/AssetTest.php +++ b/tests/Assets/AssetTest.php @@ -611,7 +611,7 @@ public function it_checks_if_its_an_audio_file() #[Test] public function it_checks_if_its_a_video_file() { - $extensions = ['h264', 'mp4', 'm4v', 'ogv', 'webm']; + $extensions = ['h264', 'mp4', 'm4v', 'ogv', 'webm', 'mov', 'mpeg', 'mpg', 'mkv']; foreach ($extensions as $ext) { $this->assertTrue((new Asset)->path("path/to/asset.$ext")->isVideo());