diff options
author | Alexander Tkachev | 2016-07-08 16:30:11 +0600 |
---|---|---|
committer | Alexander Tkachev | 2016-08-24 16:07:55 +0600 |
commit | eaa5fb175939c819785095d23bd67e3514144ec7 (patch) | |
tree | ec1f1033284f65edbd6e702dd09c6008f8bfbbc1 /backends/networking/sdl_net/handlers/filespagehandler.cpp | |
parent | f0fc18d2ee02c61524486aa1e73b781a6f64ef23 (diff) | |
download | scummvm-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.cpp | 15 |
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:")); |