Skip to content

Commit

Permalink
fix: use PATHINFO_EXTENSION when retrieving extension from pathinfo
Browse files Browse the repository at this point in the history
  • Loading branch information
romainsilvy authored and TZK- committed Nov 8, 2024
1 parent 727d28e commit 0aa260e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Presentation/Resource/ContentType.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public function getResource(string $path, string $relType = '', $external = fals
} else {
$contentType =
$this->overrides[$path]
?? $this->extensions[pathinfo($path)['extension'] ?? null]
?? $this->extensions[pathinfo($path, PATHINFO_EXTENSION) ?? null]
?? '';

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

$realContentType = $resource->getContentType();
Expand Down

0 comments on commit 0aa260e

Please sign in to comment.