From 6c0f491c4f8e809d5d2e5fd070461db1c9777958 Mon Sep 17 00:00:00 2001 From: Alexander Tkachev Date: Sat, 16 Jul 2016 11:34:35 +0600 Subject: CLOUD: Add "Index of" label in server's "/files" --- .../sdl_net/handlers/filespagehandler.cpp | 26 ++++++++++++++++++++-- 1 file changed, 24 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 1b8ab463bc..5ead4f31d9 100644 --- a/backends/networking/sdl_net/handlers/filespagehandler.cpp +++ b/backends/networking/sdl_net/handlers/filespagehandler.cpp @@ -43,6 +43,26 @@ Common::String encodeDoubleQuotes(Common::String s) { } else result += s[i]; return result; } + +Common::String encodeHtmlEntities(Common::String s) { + Common::String result = ""; + for (uint32 i = 0; i < s.size(); ++i) + if (s[i] == '<') result += "<"; + else if (s[i] == '>') result += ">"; + else if (s[i] == '&') result += "&"; + else if (s[i] > 0x7F) result += Common::String::format("%d;", (int)s[i]); + else result += s[i]; + return result; +} + +Common::String getDisplayPath(Common::String s) { + Common::String result = ""; + for (uint32 i = 0; i < s.size(); ++i) + if (s[i] == '\\') result += '/'; + else result += s[i]; + if (result == "") return "/"; + return result; +} } void FilesPageHandler::handle(Client &client) { @@ -65,6 +85,7 @@ void FilesPageHandler::handle(Client &client) { "" \ "" "