Skip to content

Commit

Permalink
Added extra checks in Uri::getContentType()
Browse files Browse the repository at this point in the history
  • Loading branch information
rhukster committed Oct 22, 2024
1 parent 5a741d9 commit f686e0a
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions system/src/Grav/Common/Uri.php
Original file line number Diff line number Diff line change
Expand Up @@ -1407,14 +1407,13 @@ public function post($element = null, $filter_type = null)
*/
public function getContentType($short = true)
{
if (isset($_SERVER['CONTENT_TYPE'])) {
$content_type = $_SERVER['CONTENT_TYPE'];
$content_type = $_SERVER['CONTENT_TYPE'] ?? $_SERVER['HTTP_CONTENT_TYPE'] ?? $_SERVER['HTTP_ACCEPT'] ?? null;
if ($content_type) {
if ($short) {
return Utils::substrToString($content_type, ';');
}
return $content_type;
}
return null;
return $content_type;
}

/**
Expand Down

0 comments on commit f686e0a

Please sign in to comment.