diff --git a/src/server/internalServer.cpp b/src/server/internalServer.cpp index 876a5f7f6..f13b9e23a 100644 --- a/src/server/internalServer.cpp +++ b/src/server/internalServer.cpp @@ -462,6 +462,11 @@ std::string noSearchResultsMsg() return "The fulltext search engine is not available for this content."; } +ParameterizedMessage invalidRawAccessMsg(const std::string& dt) +{ + return ParameterizedMessage("invalid-raw-data-type", { {"DATATYPE", dt} }); +} + ParameterizedMessage nonParameterizedMessage(const std::string& msgId) { return ParameterizedMessage(msgId, {}); @@ -924,10 +929,9 @@ std::unique_ptr InternalServer::handle_raw(const RequestContext& reque } if (kind != "meta" && kind!= "content") { - const std::string error_details = kind + " is not a valid request for raw content."; return HTTP404HtmlResponse(*this, request) + urlNotFoundMsg - + error_details; + + invalidRawAccessMsg(kind); } std::shared_ptr archive; diff --git a/static/i18n/en.json b/static/i18n/en.json index 6c34ec729..4772302fe 100644 --- a/static/i18n/en.json +++ b/static/i18n/en.json @@ -9,4 +9,5 @@ , "url-not-found" : "The requested URL \"{{url}}\" was not found on this server." , "suggest-search" : "Make a full text search for {{PATTERN}}" , "random-article-failure" : "Oops! Failed to pick a random article :(" + , "invalid-raw-data-type" : "{{DATATYPE}} is not a valid request for raw content." } diff --git a/static/i18n/qqq.json b/static/i18n/qqq.json index cbf41ffaf..34f57dd01 100644 --- a/static/i18n/qqq.json +++ b/static/i18n/qqq.json @@ -10,4 +10,5 @@ , "url-not-found" : "Error text about wrong URL for an HTTP 404 error" , "suggest-search" : "Suggest a search when the URL points to a non existing article" , "random-article-failure" : "Failure of the random article selection procedure" + , "invalid-raw-data-type" : "Invalid DATATYPE was used with the /raw endpoint (/raw//DATATYPE/...); allowed values are 'meta' and 'content'" }