diff options
author | Alexander Tkachev | 2016-07-07 15:01:07 +0600 |
---|---|---|
committer | Alexander Tkachev | 2016-08-24 16:07:55 +0600 |
commit | 4d88f51de9583d9fcdebe8fc5e90fed61416fe96 (patch) | |
tree | de0cec7ad28cb587faf784a4b4bbe478b38492a8 /backends/networking/sdl_net/handlers | |
parent | 89a1a549822dee5b18d799cd9b8e5a58190aa49d (diff) | |
download | scummvm-rg350-4d88f51de9583d9fcdebe8fc5e90fed61416fe96.tar.gz scummvm-rg350-4d88f51de9583d9fcdebe8fc5e90fed61416fe96.tar.bz2 scummvm-rg350-4d88f51de9583d9fcdebe8fc5e90fed61416fe96.zip |
CLOUD: Add query parameters URL encoding
In local webserver's links.
Fixed URL decoding to understand '+', by the way. Firefox sends these
instead of spaces and "%2B" instead of '+'.
Diffstat (limited to 'backends/networking/sdl_net/handlers')
3 files changed, 11 insertions, 5 deletions
diff --git a/backends/networking/sdl_net/handlers/createdirectoryhandler.cpp b/backends/networking/sdl_net/handlers/createdirectoryhandler.cpp index ad8a67a7e8..7b7d9ed4a0 100644 --- a/backends/networking/sdl_net/handlers/createdirectoryhandler.cpp +++ b/backends/networking/sdl_net/handlers/createdirectoryhandler.cpp @@ -44,8 +44,9 @@ void CreateDirectoryHandler::handle(Client &client) { handleErrorMessage( client, Common::String::format( - "%s<br/><a href=\"files?path=/\">%s</a>", + "%s<br/><a href=\"files?path=%s\">%s</a>", errorMessage.c_str(), + "%2F", //that's encoded "/" _("Back to the files manager") ) ); @@ -65,7 +66,10 @@ void CreateDirectoryHandler::handle(Client &client) { _("Back to parent directory") ) ); - LocalWebserver::setClientRedirectHandler(client, response, "/files?path=" + client.queryParameter("path")); + LocalWebserver::setClientRedirectHandler( + client, response, + "/files?path=" + LocalWebserver::urlEncodeQueryParameterValue(client.queryParameter("path")) + ); } void CreateDirectoryHandler::handleErrorMessage(Client &client, Common::String message) { diff --git a/backends/networking/sdl_net/handlers/downloadfilehandler.cpp b/backends/networking/sdl_net/handlers/downloadfilehandler.cpp index 59eb7dfcb3..8974cb7d19 100644 --- a/backends/networking/sdl_net/handlers/downloadfilehandler.cpp +++ b/backends/networking/sdl_net/handlers/downloadfilehandler.cpp @@ -44,8 +44,9 @@ void DownloadFileHandler::handle(Client &client) { handleErrorMessage( client, Common::String::format( - "%s<br/><a href=\"files?path=/\">%s</a>", + "%s<br/><a href=\"files?path=%s\">%s</a>", errorMessage.c_str(), + "%2F", //that's encoded "/" _("Back to the files manager") ) ); diff --git a/backends/networking/sdl_net/handlers/filespagehandler.cpp b/backends/networking/sdl_net/handlers/filespagehandler.cpp index 2ecb448c3c..c21575dc61 100644 --- a/backends/networking/sdl_net/handlers/filespagehandler.cpp +++ b/backends/networking/sdl_net/handlers/filespagehandler.cpp @@ -50,8 +50,9 @@ void FilesPageHandler::handle(Client &client) { handleErrorMessage( client, Common::String::format( - "%s<br/><a href=\"files?path=/\">%s</a>", + "%s<br/><a href=\"files?path=%s\">%s</a>", _("ScummVM couldn't list the directory you specified."), + "%2F", //that's encoded "/" _("Back to the files manager") ) ); @@ -133,7 +134,7 @@ bool FilesPageHandler::listDirectory(Common::String path, Common::String &conten void FilesPageHandler::addItem(Common::String &content, const Common::String &itemTemplate, bool isDirectory, Common::String path, Common::String name, Common::String size) { Common::String item = itemTemplate; - replace(item, "{link}", (isDirectory ? "files?path=" : "download?path=") + path); + replace(item, "{link}", (isDirectory ? "files?path=" : "download?path=") + LocalWebserver::urlEncodeQueryParameterValue(path)); replace(item, "{name}", name); replace(item, "{size}", size); content += item; |