diff --git a/src/server/internalServer.cpp b/src/server/internalServer.cpp
index f0a3750eb..43411260f 100644
--- a/src/server/internalServer.cpp
+++ b/src/server/internalServer.cpp
@@ -577,7 +577,11 @@ std::unique_ptr InternalServer::handle_request(const RequestContext& r
if (isEndpointUrl(url, "catch"))
return handle_catch(request);
- return handle_content(request);
+ std::string contentUrl = m_root + "/content" + url;
+ const std::string query = request.get_query();
+ if ( ! query.empty() )
+ contentUrl += "?" + query;
+ return Response::build_redirect(*this, contentUrl);
} catch (std::exception& e) {
fprintf(stderr, "===== Unhandled error : %s\n", e.what());
return HTTP500Response(*this, request)
diff --git a/test/server.cpp b/test/server.cpp
index 8b77f97d9..886fcf542 100644
--- a/test/server.cpp
+++ b/test/server.cpp
@@ -55,9 +55,6 @@ const ResourceCollection resources200Compressible{
{ NO_ETAG, "/ROOT/catch/external?source=www.example.com" },
- { WITH_ETAG, "/ROOT/zimfile/A/index" },
- { WITH_ETAG, "/ROOT/zimfile/A/Ray_Charles" },
-
{ WITH_ETAG, "/ROOT/content/zimfile/A/index" },
{ WITH_ETAG, "/ROOT/content/zimfile/A/Ray_Charles" },
@@ -79,13 +76,8 @@ const ResourceCollection resources200Uncompressible{
{ NO_ETAG, "/ROOT/catalog/v2/illustration/6f1d19d0-633f-087b-fb55-7ac324ff9baf?size=48" },
- { WITH_ETAG, "/ROOT/zimfile/I/m/Ray_Charles_classic_piano_pose.jpg" },
{ WITH_ETAG, "/ROOT/content/zimfile/I/m/Ray_Charles_classic_piano_pose.jpg" },
- { WITH_ETAG, "/ROOT/corner_cases/A/empty.html" },
- { WITH_ETAG, "/ROOT/corner_cases/-/empty.css" },
- { WITH_ETAG, "/ROOT/corner_cases/-/empty.js" },
-
{ WITH_ETAG, "/ROOT/content/corner_cases/A/empty.html" },
{ WITH_ETAG, "/ROOT/content/corner_cases/-/empty.css" },
{ WITH_ETAG, "/ROOT/content/corner_cases/-/empty.js" },
@@ -201,15 +193,6 @@ R"EXPECTEDRESULT(
-)EXPECTEDRESULT"
- },
- {
- /* url */ "/ROOT/zimfile/A/index",
-R"EXPECTEDRESULT(
-
-
-
-
)EXPECTEDRESULT"
},
{
@@ -268,18 +251,12 @@ TEST_F(ServerTest, 400)
const char* urls404[] = {
"/",
"/zimfile",
- "/ROOT/non-existent-item",
"/ROOT/skin/non-existent-skin-resource",
"/ROOT/catalog",
"/ROOT/catalog/",
"/ROOT/catalog/non-existent-item",
- "/ROOT/catalogBLABLABLA/root.xml",
"/ROOT/catalog/v2/illustration/zimfile?size=48",
"/ROOT/catalog/v2/illustration/6f1d19d0-633f-087b-fb55-7ac324ff9baf?size=96",
- "/ROOT/meta",
- "/ROOT/meta?content=zimfile",
- "/ROOT/meta?content=zimfile&name=non-existent-item",
- "/ROOT/meta?content=non-existent-book&name=title",
"/ROOT/random",
"/ROOT/random?content=non-existent-book",
"/ROOT/random/",
@@ -294,7 +271,6 @@ const char* urls404[] = {
"/ROOT/catch/external", // missing ?source=URL
"/ROOT/catch/external?source=",
"/ROOT/catch/anythingotherthanexternal",
- "/ROOT/zimfile/A/non-existent-article",
"/ROOT/content/zimfile/A/non-existent-article",
"/ROOT/raw/non-existent-book/meta/Title",
@@ -699,30 +675,17 @@ TEST_F(ServerTest, Http404HtmlError)
)" },
- { /* url */ "/ROOT/invalid-book/whatever",
+ { /* url */ "/ROOT/content/invalid-book/whatever",
expected_body==R"(
Not Found
- The requested URL "/ROOT/invalid-book/whatever" was not found on this server.
+ The requested URL "/ROOT/content/invalid-book/whatever" was not found on this server.
Make a full text search for whatever
)" },
- { /* url */ "/ROOT/zimfile/invalid-article",
- book_name=="zimfile" &&
- book_title=="Ray Charles" &&
- expected_body==R"(
- Not Found
-
- The requested URL "/ROOT/zimfile/invalid-article" was not found on this server.
-
-
- Make a full text search for invalid-article
-
-)" },
-
{ /* url */ "/ROOT/content/zimfile/invalid-article",
book_name=="zimfile" &&
book_title=="Ray Charles" &&
@@ -736,30 +699,17 @@ TEST_F(ServerTest, Http404HtmlError)
)" },
- { /* url */ R"(/ROOT/">)",
+ { /* url */ R"(/ROOT/content/">)",
expected_body==R"(
Not Found
- The requested URL "/ROOT/"><svg onload=alert(1)>" was not found on this server.
+ The requested URL "/ROOT/content/"><svg onload=alert(1)>" was not found on this server.
Make a full text search for "><svg onload=alert(1)>
)" },
- { /* url */ R"(/ROOT/zimfile/">)",
- book_name=="zimfile" &&
- book_title=="Ray Charles" &&
- expected_body==R"(
- Not Found
-
- The requested URL "/ROOT/zimfile/"><svg onload=alert(1)>" was not found on this server.
-
-
- Make a full text search for "><svg onload=alert(1)>
-
-)" },
-
{ /* url */ R"(/ROOT/content/zimfile/">)",
book_name=="zimfile" &&
book_title=="Ray Charles" &&
@@ -773,20 +723,6 @@ TEST_F(ServerTest, Http404HtmlError)
)" },
- { /* url */ "/ROOT/zimfile/invalid-article?userlang=hy",
- expected_page_title=="Սխալ հասցե" &&
- book_name=="zimfile" &&
- book_title=="Ray Charles" &&
- expected_body==R"(
- Սխալ հասցե
-
- Սխալ հասցե՝ /ROOT/zimfile/invalid-article
-
-
- Որոնել invalid-article
-
-)" },
-
{ /* url */ "/ROOT/content/zimfile/invalid-article?userlang=hy",
expected_page_title=="Սխալ հասցե" &&
book_name=="zimfile" &&
@@ -1042,12 +978,6 @@ TEST_F(ServerTest, 500)