mirror of
https://github.com/kiwix/libkiwix.git
synced 2025-06-26 10:11:30 +00:00
Proper URI-encoding in InternalServer::build_redirect()
- Before this change `InternalServer::build_redirect()` only URI-encoded the article path, ignoring the book name and/or the root location components of the URL. - In order to be able to test this fix, corner_cases.zim was renamed to contain a couple of special URL symbols in its filename. The `create_corner_cases_zim_file` script was updated accordingly.
This commit is contained in:
@ -1030,9 +1030,8 @@ ParameterizedMessage suggestSearchMsg(const std::string& searchURL, const std::s
|
||||
std::unique_ptr<Response>
|
||||
InternalServer::build_redirect(const std::string& bookName, const zim::Item& item) const
|
||||
{
|
||||
const auto path = kiwix::urlEncode(item.getPath());
|
||||
const auto redirectUrl = m_root + "/content/" + bookName + "/" + path;
|
||||
return Response::build_redirect(*this, redirectUrl);
|
||||
const auto absPath = m_root + "/content/" + bookName + "/" + item.getPath();
|
||||
return Response::build_redirect(*this, kiwix::urlEncode(absPath));
|
||||
}
|
||||
|
||||
std::unique_ptr<Response> InternalServer::handle_content(const RequestContext& request)
|
||||
|
Reference in New Issue
Block a user