Skip to content

Commit

Permalink
wsd: do not encode the URI if the API is "convert-to"
Browse files Browse the repository at this point in the history
If it is encoded again, the result file does
not exist.

If a file is "test___á.pdf" and encode again
"test___%C3%A1.pdf"

fileExists("test___%C3%A1.pdf") false

Change-Id: I9fa1b8b52ebf0993158eb6ebe383da53921f640a
  • Loading branch information
hcvcastro committed Oct 5, 2020
1 parent 2f6c334 commit d541429
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions wsd/ClientSession.cpp
Expand Up @@ -1257,11 +1257,18 @@ bool ClientSession::handleKitToClientMessage(const char* buffer, const int lengt
const Path path(docBroker->getJailRoot(), relative);
if (Poco::File(path).exists())
{
// Encode path for special characters (i.e '%') since Poco::URI::setPath implicitly decodes the input param
std::string encodedPath;
Poco::URI::encode(path.toString(), "", encodedPath);
if (!isConvertTo)
{
// Encode path for special characters (i.e '%') since Poco::URI::setPath implicitly decodes the input param
std::string encodedPath;
Poco::URI::encode(path.toString(), "", encodedPath);

resultURL.setPath(encodedPath);
resultURL.setPath(encodedPath);
}
else
{
resultURL.setPath(path.toString());
}
}
else
{
Expand Down

0 comments on commit d541429

Please sign in to comment.