Skip to content
This repository was archived by the owner on Jan 13, 2025. It is now read-only.

Commit d5d6862

Browse files
author
Joshua Moon
committed
Resolved FFMPEG complaint on unid files.
1 parent de8507d commit d5d6862

File tree

3 files changed

+22
-18
lines changed

3 files changed

+22
-18
lines changed

src/Detectives/ffmpegDetective.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ private function ffprobeFormat($format)
7070
{
7171
$this->ffprobe();
7272

73-
if (count($this->formats) > 0) {
73+
if (is_array($this->formats) && count($this->formats) > 0) {
7474
$args = func_get_args();
7575

7676
foreach ($args as $arg) {

src/FileSleuth.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
namespace InfinityNext\Sleuth;
44

55
use InfinityNext\Sleuth\Contracts\DetectiveContract;
6-
use InfinityNext\Sleuth\Detectives\ImageGDDetective;
76
use InfinityNext\Sleuth\Detectives\ffmpegDetective;
8-
use InfinityNext\Sleuth\Detectives\svgDetective;
97
use InfinityNext\Sleuth\Detectives\ImagickDetective;
8+
use InfinityNext\Sleuth\Detectives\ImageGDDetective;
9+
use InfinityNext\Sleuth\Detectives\PlaintextDetective;
10+
use InfinityNext\Sleuth\Detectives\svgDetective;
1011

1112
class FileSleuth
1213
{
@@ -17,9 +18,10 @@ class FileSleuth
1718
*/
1819
protected $detectives = [
1920
ImageGDDetective::class,
20-
ffmpegDetective::class,
2121
svgDetective::class,
2222
ImagickDetective::class,
23+
PlaintextDetective::class,
24+
ffmpegDetective::class,
2325
];
2426

2527
/**

tests/SleuthTest.php

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,22 @@
55

66
class SleuthTest extends TestCase
77
{
8-
public function testSleuth()
9-
{
10-
$files = [
11-
'jpg' => __DIR__ . "/files/normal.jpg",
12-
'mp4' => __DIR__ . "/files/normal.mp4",
13-
'svg' => __DIR__ . "/files/normal.svg",
14-
];
8+
public function testSleuth()
9+
{
10+
$files = [
11+
'jpg' => __DIR__ . "/files/normal.jpg",
12+
'mp4' => __DIR__ . "/files/normal.mp4",
13+
'svg' => __DIR__ . "/files/normal.svg",
14+
'asc' => __DIR__ . "/files/pubkey.asc",
15+
'pdf' => __DIR__ . "/files/normal.pdf",
16+
];
1517

16-
foreach ($files as $ext => $file)
17-
{
18-
$sleuth = new FileSleuth($file);
19-
$case = $sleuth->check($file);
18+
foreach ($files as $ext => $file)
19+
{
20+
$sleuth = new FileSleuth($file);
21+
$case = $sleuth->check($file);
2022

21-
$this->assertEquals($ext, $case->getExtension());
22-
}
23-
}
23+
$this->assertEquals($ext, $case->getExtension());
24+
}
25+
}
2426
}

0 commit comments

Comments
 (0)