mirror of
https://github.com/kiwix/libkiwix.git
synced 2026-10-20 16:15:13 -04:00
/ is no longer a reserved char for urlEncode()
This change is a quick hack solving known issues with URI-encoding in libkiwix. This change removes the slash character from the list of URL separator symbols in URL encoding/decoding utilities, and makes it a symbol that is safe to leave unencoded. Effects: - `urlEncode()` never encodes the '/' symbol (even when it is requested to encode the URL separator symbols too). - `urlDecode(str)`/`urlDecode(..., false)` will now decode %2F to '/'; other encoded URL separator symbols are NOT decoded when the second argument of `urlDecode()` is set to false (which is the default).
This commit is contained in:
1 parent
c5ccbd37e2
commit
239b108fa7
3 files changed
+6
-6
No files matched your search
+2
-2
@@ -1156,7 +1156,7 @@ TEST_F(ServerTest, RandomPageRedirectsToAnExistingArticle)
|
||||
auto g = zfs1_->GET("/ROOT/random?content=zimfile");
|
||||
ASSERT_EQ(302, g->status);
|
||||
ASSERT_TRUE(g->has_header("Location"));
|
||||
ASSERT_TRUE(kiwix::startsWith(g->get_header_value("Location"), "/ROOT/content/zimfile/A%2F"));
|
||||
ASSERT_TRUE(kiwix::startsWith(g->get_header_value("Location"), "/ROOT/content/zimfile/A/"));
|
||||
ASSERT_EQ(getCacheControlHeader(*g), "max-age=0, must-revalidate");
|
||||
ASSERT_FALSE(g->has_header("ETag"));
|
||||
}
|
||||
@@ -1224,7 +1224,7 @@ TEST_F(ServerTest, BookMainPageIsRedirectedToArticleIndex)
|
||||
auto g = zfs1_->GET("/ROOT/content/zimfile");
|
||||
ASSERT_EQ(302, g->status);
|
||||
ASSERT_TRUE(g->has_header("Location"));
|
||||
ASSERT_EQ("/ROOT/content/zimfile/A%2Findex", g->get_header_value("Location"));
|
||||
ASSERT_EQ("/ROOT/content/zimfile/A/index", g->get_header_value("Location"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user