From 0d4f956fbab8042dc90711e5fec992fec7f17728 Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 3 Apr 2024 05:57:23 +0000 Subject: [PATCH] Avoid exception "Unable to retrieve the host in URL" in the search --- src/Model/Item.php | 11 ++++++++--- view/lang/C/messages.po | 44 ++++++++++++++++++++--------------------- 2 files changed, 30 insertions(+), 25 deletions(-) diff --git a/src/Model/Item.php b/src/Model/Item.php index 516b7d1e9b..a8c76cfa30 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -4132,9 +4132,14 @@ class Item return is_numeric($hookData['item_id']) ? $hookData['item_id'] : 0; } - $curlResult = DI::httpClient()->head($uri, [HttpClientOptions::ACCEPT_CONTENT => HttpClientAccept::JSON_AS]); - if (HTTPSignature::isValidContentType($curlResult->getContentType(), $uri)) { - $fetched_uri = ActivityPub\Processor::fetchMissingActivity($uri, [], '', $completion, $uid); + try { + $curlResult = DI::httpClient()->head($uri, [HttpClientOptions::ACCEPT_CONTENT => HttpClientAccept::JSON_AS]); + if (HTTPSignature::isValidContentType($curlResult->getContentType(), $uri)) { + $fetched_uri = ActivityPub\Processor::fetchMissingActivity($uri, [], '', $completion, $uid); + } + } catch (\Throwable $th) { + Logger::info('Invalid link', ['uid' => $uid, 'uri' => $uri, 'code' => $th->getCode(), 'message' => $th->getMessage()]); + return 0; } if (!empty($fetched_uri)) { diff --git a/view/lang/C/messages.po b/view/lang/C/messages.po index a0aba978cd..b09b544fdb 100644 --- a/view/lang/C/messages.po +++ b/view/lang/C/messages.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: 2024.06-dev\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-29 20:29+0000\n" +"POT-Creation-Date: 2024-04-03 07:49+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -1792,7 +1792,7 @@ msgstr "" msgid "Display a list of folders in which posts are stored." msgstr "" -#: src/Content/Feature.php:137 src/Module/Conversation/Timeline.php:196 +#: src/Content/Feature.php:137 src/Module/Conversation/Timeline.php:198 msgid "Own Contacts" msgstr "" @@ -2791,8 +2791,8 @@ msgstr "" #: src/Core/Installer.php:516 msgid "" -"The web installer needs to be able to create a file called \"local.config." -"php\" in the \"config\" folder of your web server and it is unable to do so." +"The web installer needs to be able to create a file called \"local.config.php" +"\" in the \"config\" folder of your web server and it is unable to do so." msgstr "" #: src/Core/Installer.php:517 @@ -3952,8 +3952,8 @@ msgid "" "profile\n" "\t\t\t(on the \"Profiles\" page) so that other people can easily find you.\n" "\n" -"\t\t\tWe recommend adding a profile photo, adding some profile " -"\"keywords\" (very useful\n" +"\t\t\tWe recommend adding a profile photo, adding some profile \"keywords" +"\" (very useful\n" "\t\t\tin making new friends) - and perhaps what country you live in; if you " "do not wish\n" "\t\t\tto be more specific than that.\n" @@ -5727,9 +5727,9 @@ msgstr "" #: src/Module/Admin/Summary.php:98 msgid "" -"The last update failed. Please run \"php bin/console.php dbstructure " -"update\" from the command line and have a look at the errors that might " -"appear. (Some of the errors are possibly inside the logfile.)" +"The last update failed. Please run \"php bin/console.php dbstructure update" +"\" from the command line and have a look at the errors that might appear. " +"(Some of the errors are possibly inside the logfile.)" msgstr "" #: src/Module/Admin/Summary.php:102 @@ -5880,8 +5880,8 @@ msgstr "" #, php-format msgid "" "Show some informations regarding the needed information to operate the node " -"according e.g. to EU-GDPR." +"according e.g. to EU-GDPR." msgstr "" #: src/Module/Admin/Tos.php:81 @@ -7143,11 +7143,11 @@ msgstr "" msgid "Network feed not available." msgstr "" -#: src/Module/Conversation/Timeline.php:200 +#: src/Module/Conversation/Timeline.php:202 msgid "Include" msgstr "" -#: src/Module/Conversation/Timeline.php:201 +#: src/Module/Conversation/Timeline.php:203 msgid "Hide" msgstr "" @@ -9186,8 +9186,8 @@ msgstr "" #: src/Module/Profile/Profile.php:158 #, php-format msgid "" -"You're currently viewing your profile as %s Cancel" +"You're currently viewing your profile as %s Cancel" msgstr "" #: src/Module/Profile/Profile.php:167 @@ -9707,8 +9707,8 @@ msgstr "" #: src/Module/Security/TwoFactor/Verify.php:100 #, php-format msgid "" -"If you do not have access to your authentication code you can use a two-factor recovery code." +"If you do not have access to your authentication code you can use a two-factor recovery code." msgstr "" #: src/Module/Security/TwoFactor/Verify.php:101 @@ -11416,8 +11416,8 @@ msgstr "" #: src/Module/Settings/TwoFactor/Verify.php:152 #, php-format msgid "" -"

Or you can open the following URL in your mobile device:

%s

" +"

Or you can open the following URL in your mobile device:

%s

" msgstr "" #: src/Module/Settings/TwoFactor/Verify.php:159 @@ -11526,9 +11526,9 @@ msgstr "" msgid "" "At any point in time a logged in user can export their account data from the " "account settings. If the user wants " -"to delete their account they can do so at %1$s/settings/removeme. The deletion of the account will be " -"permanent. Deletion of the data will also be requested from the nodes of the " +"to delete their account they can do so at " +"%1$s/settings/removeme. The deletion of the account will be permanent. " +"Deletion of the data will also be requested from the nodes of the " "communication partners." msgstr ""