aboutsummaryrefslogtreecommitdiff
path: root/backends/networking/sdl_net/handlers/filespagehandler.cpp
diff options
context:
space:
mode:
authorAlexander Tkachev2016-07-08 16:30:11 +0600
committerAlexander Tkachev2016-08-24 16:07:55 +0600
commiteaa5fb175939c819785095d23bd67e3514144ec7 (patch)
treeec1f1033284f65edbd6e702dd09c6008f8bfbbc1 /backends/networking/sdl_net/handlers/filespagehandler.cpp
parentf0fc18d2ee02c61524486aa1e73b781a6f64ef23 (diff)
downloadscummvm-rg350-eaa5fb175939c819785095d23bd67e3514144ec7.tar.gz
scummvm-rg350-eaa5fb175939c819785095d23bd67e3514144ec7.tar.bz2
scummvm-rg350-eaa5fb175939c819785095d23bd67e3514144ec7.zip
CLOUD: Put "/upload" "path" parameter in the URL
Diffstat (limited to 'backends/networking/sdl_net/handlers/filespagehandler.cpp')
-rw-r--r--backends/networking/sdl_net/handlers/filespagehandler.cpp15
1 files changed, 13 insertions, 2 deletions
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 = "<html><head><title>ScummVM</title></head><body><table>{content}</table></body></html>"; //TODO: add controls
Common::String itemTemplate = "<tr><td><a href=\"{link}\">{name}</a></td><td>{size}</td></tr>\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:"));