CLOUD: Redirect to "/files" from "/"

"/" is used to receive "?code", but when there is no such parameter
passed, it's safe to redirect user to the "/files".
This commit is contained in:
Alexander Tkachev 2016-07-13 00:45:31 +06:00
parent b37b392fa0
commit 0a43dad629

View File

@ -35,8 +35,18 @@ IndexPageHandler::~IndexPageHandler() {}
void IndexPageHandler::handle(Client &client) {
Common::String code = client.queryParameter("code");
if (code == "") {
HandlerUtils::setMessageHandler(client, _("This is a local webserver index page."));
if (code == "") {
// redirect to "/files"
HandlerUtils::setMessageHandler(
client,
Common::String::format(
"%s<br/><a href=\"files\">%s</a>",
_("This is a local webserver index page."),
client.queryParameter("path").c_str(),
_("Open Files manager")
),
"/files"
);
return;
}