Skip to content

Commit 0aa260e

Browse files
romainsilvyTZK-
authored andcommitted
fix: use PATHINFO_EXTENSION when retrieving extension from pathinfo
1 parent 727d28e commit 0aa260e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Presentation/Resource/ContentType.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public function getResource(string $path, string $relType = '', $external = fals
128128
} else {
129129
$contentType =
130130
$this->overrides[$path]
131-
?? $this->extensions[pathinfo($path)['extension'] ?? null]
131+
?? $this->extensions[pathinfo($path, PATHINFO_EXTENSION) ?? null]
132132
?? '';
133133

134134
$className = static::getResourceClassFromType($contentType);
@@ -199,7 +199,7 @@ public function isDraft(): bool
199199
*/
200200
public function addResource(GenericResource $resource): void
201201
{
202-
$fileExtension = pathinfo($resource->getTarget())['extension'];
202+
$fileExtension = pathinfo($resource->getTarget(), PATHINFO_EXTENSION);
203203
$fileContentType = $this->extensions[$fileExtension] ?? null;
204204

205205
$realContentType = $resource->getContentType();

0 commit comments

Comments
 (0)