Skip to content

Commit 8631fec

Browse files
Fix for incorrectly receiving file extension. Now pathinfo() function is used.
1 parent 42bc2ae commit 8631fec

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

src/Parser.php

+1-7
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,7 @@ function parse(array $resultDiff, string $format): string
1818
function parseToJson(string $path): array
1919
{
2020
$content = getFileContent($path);
21-
$offset = strpos($path, '.');
22-
23-
if ($offset === false) {
24-
throw new Exception("Incorrect path: {$path}");
25-
}
26-
27-
$extension = substr($path, $offset + 1);
21+
$extension = pathinfo($path, PATHINFO_EXTENSION);
2822
$message = "The file format is not supported by the current version of the program: {$extension}";
2923

3024
return match ($extension) {

0 commit comments

Comments
 (0)