diff options
author | Alexander Tkachev | 2016-07-19 13:41:25 +0600 |
---|---|---|
committer | Alexander Tkachev | 2016-08-24 16:07:55 +0600 |
commit | da229dd84c5761f80b16c25edba7bfb738fc835f (patch) | |
tree | d52f1815a56e718675a0ff9298b99f6ab05ef939 /backends/networking/sdl_net/handlers | |
parent | e6caa482e1e7c0e6d9f8201331332b9f5425b79d (diff) | |
download | scummvm-rg350-da229dd84c5761f80b16c25edba7bfb738fc835f.tar.gz scummvm-rg350-da229dd84c5761f80b16c25edba7bfb738fc835f.tar.bz2 scummvm-rg350-da229dd84c5761f80b16c25edba7bfb738fc835f.zip |
CLOUD: Add "ajax" parameter for "/create" and "/upload"
If it's set, these redirect to "/filesAJAX" instead of "/files".
Diffstat (limited to 'backends/networking/sdl_net/handlers')
-rw-r--r-- | backends/networking/sdl_net/handlers/createdirectoryhandler.cpp | 4 | ||||
-rw-r--r-- | backends/networking/sdl_net/handlers/filesajaxpagehandler.cpp | 14 |
2 files changed, 17 insertions, 1 deletions
diff --git a/backends/networking/sdl_net/handlers/createdirectoryhandler.cpp b/backends/networking/sdl_net/handlers/createdirectoryhandler.cpp index 97d75fcf14..fc02b643c1 100644 --- a/backends/networking/sdl_net/handlers/createdirectoryhandler.cpp +++ b/backends/networking/sdl_net/handlers/createdirectoryhandler.cpp @@ -85,7 +85,9 @@ void CreateDirectoryHandler::handle(Client &client) { client.queryParameter("path").c_str(), _("Back to parent directory") ), - "/files?path=" + LocalWebserver::urlEncodeQueryParameterValue(client.queryParameter("path")) + + (client.queryParameter("ajax") == "true" ? "/filesAJAX?path=" : "/files?path=") + + LocalWebserver::urlEncodeQueryParameterValue(client.queryParameter("path")) ); } diff --git a/backends/networking/sdl_net/handlers/filesajaxpagehandler.cpp b/backends/networking/sdl_net/handlers/filesajaxpagehandler.cpp index 17be7faad2..df4482166a 100644 --- a/backends/networking/sdl_net/handlers/filesajaxpagehandler.cpp +++ b/backends/networking/sdl_net/handlers/filesajaxpagehandler.cpp @@ -33,6 +33,19 @@ FilesAjaxPageHandler::FilesAjaxPageHandler() {} FilesAjaxPageHandler::~FilesAjaxPageHandler() {} +namespace { +Common::String encodeDoubleQuotesAndSlashes(Common::String s) { + Common::String result = ""; + for (uint32 i = 0; i < s.size(); ++i) + if (s[i] == '"') { + result += "\\\""; + } else if (s[i] == '\\') { + result += "\\\\"; + } else result += s[i]; + return result; +} +} + void FilesAjaxPageHandler::handle(Client &client) { // load stylish response page from the archive Common::SeekableReadStream *const stream = HandlerUtils::getArchiveFile(FILES_PAGE_NAME); @@ -55,6 +68,7 @@ void FilesAjaxPageHandler::handle(Client &client) { replace(response, "{index_of}", _("Index of ")); replace(response, "{loading}", _("Loading...")); replace(response, "{error}", _("Error occurred")); + replace(response, "{start_path}", encodeDoubleQuotesAndSlashes(path)); LocalWebserver::setClientGetHandler(client, response); } |