[Libreoffice-commits] online.git: wsd/FileServer.cpp
Ashod Nakashian
ashod.nakashian at collabora.co.uk
Wed Dec 21 15:01:57 UTC 2016
wsd/FileServer.cpp | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
New commits:
commit e1d5bf4ec283e6b1d780a6a1d78c59910a06035f
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date: Mon Dec 19 21:32:08 2016 -0500
wsd: no need for first foreslash in local path
Since the local path already ends in foreslash,
no need to keep the on in provided by the client.
Change-Id: Ia2bc24c7faa84509f9ec18deefb14cad2858e856
Reviewed-on: https://gerrit.libreoffice.org/32288
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
diff --git a/wsd/FileServer.cpp b/wsd/FileServer.cpp
index b79c376..67656f3 100644
--- a/wsd/FileServer.cpp
+++ b/wsd/FileServer.cpp
@@ -148,7 +148,9 @@ void FileServerRequestHandler::handleRequest(HTTPServerRequest& request, HTTPSer
const std::size_t extPoint = endPoint.find_last_of('.');
if (extPoint == std::string::npos)
+ {
throw Poco::FileNotFoundException("Invalid file.");
+ }
const std::string fileType = endPoint.substr(extPoint + 1);
std::string mimeType;
@@ -199,8 +201,8 @@ std::string FileServerRequestHandler::getRequestPathname(const HTTPServerRequest
std::string path(requestUri.getPath());
- // convert version back to a real file name
- Poco::replaceInPlace(path, std::string("/loleaflet/" LOOLWSD_VERSION_HASH "/"), std::string("/loleaflet/dist/"));
+ // Convert version back to a real file name. Remove first foreslash as the root ends in one.
+ Poco::replaceInPlace(path, std::string("/loleaflet/" LOOLWSD_VERSION_HASH "/"), std::string("loleaflet/dist/"));
return path;
}
More information about the Libreoffice-commits
mailing list