Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Assets/Asset.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions src/Rules/AllowedFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class AllowedFile implements ValidationRule
{
private const EXTENSIONS = [
'7z',
'aac',
'aiff',
'asc',
'asf',
Expand All @@ -25,10 +26,12 @@ class AllowedFile implements ValidationRule
'dotm',
'dotx',
'fla',
'flac',
'flv',
'gif',
'gz',
'gzip',
'h264',
'heic',
'heif',
'hevc',
Expand All @@ -46,6 +49,7 @@ class AllowedFile implements ValidationRule
'mcc',
'md',
'mid',
'mkv',
'mov',
'mp3',
'mp4',
Expand Down
8 changes: 5 additions & 3 deletions src/Support/FileTypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace Statamic\Support;

use Statamic\Assets\Asset;

class FileTypes
{
public static function media(): array
Expand All @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/Assets/AssetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
Loading