Browse Source

add content type detection by path extension

PHP-GTK3
yggverse 5 months ago
parent
commit
1336e844ff
  1. 20
      src/Entity/Browser/Container/Tab/Page/Content.php

20
src/Entity/Browser/Container/Tab/Page/Content.php

@ -185,7 +185,7 @@ class Content @@ -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 @@ -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…
Cancel
Save