diff options
author | Tor Lillqvist <tml@collabora.com> | 2019-11-21 15:29:51 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2019-11-28 00:04:03 +0100 |
commit | 1879a45a057b04a8f2d23b505b5c931f9c9e4151 (patch) | |
tree | 57ef367c64dd2b1d24690f3f233ea6ffbc4e8c89 | |
parent | 13d409421aea7592e00925f359aa9eb4abd1d84a (diff) |
tdf#125755: Fix some URI encoding issues
Now the iOS app is able to open a document called A#B?C\D&E❤️F🇨🇭G%AAHÖ.doc.
That is, with ‘#’, ‘?’, and ‘&’ that can mess things up when parsing URIs,
non-ASCII and even non-BMP characters, and an actual percent
character in the file name. Is that a complete enough test case? Will see.
Change-Id: I7fc53eaf8188f633d442d14a7f42814553169c71
Reviewed-on: https://gerrit.libreoffice.org/83395
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
(cherry picked from commit b60ccd60c59efb5a03ea698c0205a8543846d9e2)
Reviewed-on: https://gerrit.libreoffice.org/83749
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Andras Timar <andras.timar@collabora.com>
-rw-r--r-- | wsd/DocumentBroker.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp index 30d6d5e8d..03c6edf5d 100644 --- a/wsd/DocumentBroker.cpp +++ b/wsd/DocumentBroker.cpp @@ -90,9 +90,7 @@ std::string getCachePath(const std::string& uri) Poco::URI DocumentBroker::sanitizeURI(const std::string& uri) { // The URI of the document should be url-encoded. - std::string decodedUri; - Poco::URI::decode(uri, decodedUri); - Poco::URI uriPublic(decodedUri); + Poco::URI uriPublic(uri); if (uriPublic.isRelative() || uriPublic.getScheme() == "file") { @@ -741,9 +739,8 @@ bool DocumentBroker::load(const std::shared_ptr<ClientSession>& session, const s LOG_INF("SHA1 for DocKey [" << _docKey << "] of [" << LOOLWSD::anonymizeUrl(localPath) << "]: " << Poco::DigestEngine::digestToHex(sha1.digest())); - // LibreOffice can't open files with '#' in the name std::string localPathEncoded; - Poco::URI::encode(localPath, "#", localPathEncoded); + Poco::URI::encode(localPath, "#?", localPathEncoded); _uriJailed = Poco::URI(Poco::URI("file://"), localPathEncoded).toString(); _uriJailedAnonym = Poco::URI(Poco::URI("file://"), LOOLWSD::anonymizeUrl(localPathEncoded)).toString(); |