From 97642e770b0260bc5d7e067e40e818ccdeff6141 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sat, 7 Jan 2023 22:47:52 -0500 Subject: [PATCH 1/2] Treat unsupported API call as HTTP error --- src/Module/Api/ApiResponse.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Module/Api/ApiResponse.php b/src/Module/Api/ApiResponse.php index 2d54bc1765..b5b2a4717c 100644 --- a/src/Module/Api/ApiResponse.php +++ b/src/Module/Api/ApiResponse.php @@ -276,9 +276,8 @@ class ApiResponse extends Response 'agent' => $_SERVER['HTTP_USER_AGENT'] ?? '', 'request' => $request, ]); - $error = $this->l10n->t('API endpoint %s %s is not implemented', strtoupper($method), $path); - $error_description = $this->l10n->t('The API endpoint is currently not implemented but might be in the future.'); + $error = $this->l10n->t('API endpoint %s %s is not implemented but might be in the future.', strtoupper($method), $path); - $this->exit('error', ['error' => ['error' => $error, 'error_description' => $error_description]]); + $this->error(501, 'Not Implemented', $error); } } From 6c379610dc0c9ca0af3174b21e88d35246443ae3 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sat, 7 Jan 2023 22:48:31 -0500 Subject: [PATCH 2/2] Update main translation file after removing a string --- view/lang/C/messages.po | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/view/lang/C/messages.po b/view/lang/C/messages.po index ab61019233..4bd45b35b6 100644 --- a/view/lang/C/messages.po +++ b/view/lang/C/messages.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: 2023.03-dev\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-01-07 17:15+0000\n" +"POT-Creation-Date: 2023-01-07 22:48-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -18,34 +18,34 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" -#: mod/item.php:101 mod/item.php:105 mod/item.php:178 mod/item.php:182 +#: mod/item.php:101 mod/item.php:104 mod/item.php:170 mod/item.php:173 #: src/Content/Item.php:860 msgid "Unable to locate original post." msgstr "" -#: mod/item.php:139 +#: mod/item.php:138 msgid "Post updated." msgstr "" -#: mod/item.php:213 mod/item.php:218 +#: mod/item.php:201 mod/item.php:205 msgid "Item wasn't stored." msgstr "" -#: mod/item.php:228 +#: mod/item.php:215 msgid "Item couldn't be fetched." msgstr "" -#: mod/item.php:273 mod/item.php:278 +#: mod/item.php:261 mod/item.php:265 msgid "Empty post discarded." msgstr "" -#: mod/item.php:414 src/Module/Admin/Themes/Details.php:39 +#: mod/item.php:401 src/Module/Admin/Themes/Details.php:39 #: src/Module/Admin/Themes/Index.php:59 src/Module/Debug/ItemBody.php:42 #: src/Module/Debug/ItemBody.php:57 src/Module/Item/Feed.php:80 msgid "Item not found." msgstr "" -#: mod/item.php:438 mod/message.php:69 mod/message.php:114 mod/notes.php:44 +#: mod/item.php:425 mod/message.php:69 mod/message.php:114 mod/notes.php:44 #: mod/photos.php:158 mod/photos.php:675 src/Model/Event.php:522 #: src/Module/Attach.php:55 src/Module/BaseApi.php:95 #: src/Module/BaseNotifications.php:98 src/Module/BaseSettings.php:52 @@ -5220,12 +5220,7 @@ msgstr "" #: src/Module/Api/ApiResponse.php:279 #, php-format -msgid "API endpoint %s %s is not implemented" -msgstr "" - -#: src/Module/Api/ApiResponse.php:280 -msgid "" -"The API endpoint is currently not implemented but might be in the future." +msgid "API endpoint %s %s is not implemented but might be in the future." msgstr "" #: src/Module/Api/Mastodon/Apps.php:64 @@ -8136,17 +8131,17 @@ msgstr "" msgid "The Photo is not available." msgstr "" -#: src/Module/Photo.php:142 +#: src/Module/Photo.php:154 #, php-format msgid "The Photo with id %s is not available." msgstr "" -#: src/Module/Photo.php:179 +#: src/Module/Photo.php:191 #, php-format msgid "Invalid external resource with url %s." msgstr "" -#: src/Module/Photo.php:181 +#: src/Module/Photo.php:193 #, php-format msgid "Invalid photo with id %s." msgstr ""