[Libreoffice-commits] online.git: loolwsd/LOOLWSD.cpp
Jan Holesovsky
kendy at collabora.com
Thu Jan 21 14:31:12 PST 2016
loolwsd/LOOLWSD.cpp | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
New commits:
commit 0c509e17c1800f96dbc2f8f732148ecbb825f746
Author: Jan Holesovsky <kendy at collabora.com>
Date: Thu Jan 21 23:11:01 2016 +0100
loolwsd: Fix /convert-to to handle filenames containing spaces.
diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index 531818d..edfcb7d 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -356,22 +356,29 @@ public:
const LOOLSession::Kind kind = LOOLSession::Kind::ToClient;
auto session = std::make_shared<MasterProcessSession>(id, kind, ws);
const std::string filePrefix("file://");
- const std::string load = "load url=" + filePrefix + fromPath;
+ std::string encodedFrom;
+ URI::encode(filePrefix + fromPath, std::string(), encodedFrom);
+ const std::string load = "load url=" + encodedFrom;
session->handleInput(load.data(), load.size());
// Convert it to the requested format.
Path toPath(fromPath);
toPath.setExtension(format);
std::string toJailURL = filePrefix + JailedDocumentRoot + toPath.getFileName();
- std::string saveas = "saveas url=" + toJailURL + " format=" + format + " options=";
+ std::string encodedTo;
+ URI::encode(toJailURL, std::string(), encodedTo);
+ std::string saveas = "saveas url=" + encodedTo + " format=" + format + " options=";
session->handleInput(saveas.data(), saveas.size());
+
std::string toURL = session->getSaveAs();
+ std::string resultingURL;
+ URI::decode(toURL, resultingURL);
// Send it back to the client.
std::string mimeType = "application/octet-stream";
- if (toURL.find(filePrefix) == 0)
- toURL = toURL.substr(filePrefix.length());
- response.sendFile(toURL, mimeType);
+ if (resultingURL.find(filePrefix) == 0)
+ resultingURL = resultingURL.substr(filePrefix.length());
+ response.sendFile(resultingURL, mimeType);
}
else
{
More information about the Libreoffice-commits
mailing list