From eaa5fb175939c819785095d23bd67e3514144ec7 Mon Sep 17 00:00:00 2001 From: Alexander Tkachev Date: Fri, 8 Jul 2016 16:30:11 +0600 Subject: CLOUD: Put "/upload" "path" parameter in the URL --- backends/networking/sdl_net/handlers/filespagehandler.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'backends/networking/sdl_net/handlers') diff --git a/backends/networking/sdl_net/handlers/filespagehandler.cpp b/backends/networking/sdl_net/handlers/filespagehandler.cpp index c21575dc61..228bf7657b 100644 --- a/backends/networking/sdl_net/handlers/filespagehandler.cpp +++ b/backends/networking/sdl_net/handlers/filespagehandler.cpp @@ -34,6 +34,17 @@ FilesPageHandler::FilesPageHandler() {} FilesPageHandler::~FilesPageHandler() {} +namespace { +Common::String encodeDoubleQuotes(Common::String s) { + Common::String result = ""; + for (uint32 i = 0; i < s.size(); ++i) + if (s[i] == '"') { + result += "\\\""; + } else result += s[i]; + return result; +} +} + void FilesPageHandler::handle(Client &client) { Common::String response = "ScummVM{content}
"; //TODO: add controls Common::String itemTemplate = "{name}{size}\n"; //TODO: load this template too? @@ -62,8 +73,8 @@ void FilesPageHandler::handle(Client &client) { //these occur twice: replace(response, "{create_directory_button}", _("Create directory")); replace(response, "{create_directory_button}", _("Create directory")); - replace(response, "{path}", client.queryParameter("path")); - replace(response, "{path}", client.queryParameter("path")); + replace(response, "{path}", encodeDoubleQuotes(client.queryParameter("path"))); + replace(response, "{path}", encodeDoubleQuotes(client.queryParameter("path"))); replace(response, "{upload_files_button}", _("Upload files")); //tab replace(response, "{upload_file_button}", _("Upload files")); //button in the tab replace(response, "{create_directory_desc}", _("Type new directory name:")); -- cgit v1.2.3