mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 09:05:27 +00:00
add content type detection by path extension
This commit is contained in:
parent
dca454cf50
commit
1336e844ff
1 changed files with 17 additions and 3 deletions
|
|
@ -185,7 +185,7 @@ class Content
|
|||
$request->getResponse()
|
||||
);
|
||||
|
||||
// Route status codes
|
||||
// Route status code
|
||||
// https://geminiprotocol.net/docs/protocol-specification.gmi#status-codes
|
||||
switch ($response->getCode())
|
||||
{
|
||||
|
|
@ -211,10 +211,24 @@ class Content
|
|||
|
||||
case 20: // ok
|
||||
|
||||
// Process content type
|
||||
// Detect content type
|
||||
switch (true)
|
||||
{
|
||||
case str_contains($response->getMeta(), 'text/gemini'):
|
||||
case str_contains(
|
||||
$response->getMeta(),
|
||||
'text/gemini'
|
||||
):
|
||||
|
||||
case in_array(
|
||||
pathinfo(
|
||||
$address->getPath(),
|
||||
PATHINFO_EXTENSION
|
||||
),
|
||||
[
|
||||
'gmi',
|
||||
'gemini'
|
||||
]
|
||||
):
|
||||
|
||||
$title = null;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue