[Libreoffice-commits] online.git: Branch 'distro/collabora/milestone-7' - loolwsd/LOOLWSD.cpp
Jan Holesovsky
kendy at collabora.com
Thu Jan 21 14:24:11 PST 2016
loolwsd/LOOLWSD.cpp | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
New commits:
commit a4938fa2dd1700fab32a71f1f6d0817e6a01a56d
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 f18d868..eb6794e 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -260,22 +260,28 @@ public:
LOOLSession::Kind kind = LOOLSession::Kind::ToClient;
std::shared_ptr<MasterProcessSession> session(new MasterProcessSession(ws, kind));
const std::string filePrefix("file://");
- std::string load = "load url=" + filePrefix + fromPath;
+ std::string encodedFrom;
+ URI::encode(filePrefix + fromPath, std::string(), encodedFrom);
+ 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 + LOOLSession::jailDocumentURL + Path::separator() + 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