From cf965fe4e3be00f7ca8d6e0848c315efaa4ee6ed Mon Sep 17 00:00:00 2001 From: Ashod Nakashian Date: Thu, 3 Dec 2020 21:36:14 -0500 Subject: [PATCH] wsd: do not decode already decoded fields The different attributes of a document/user are decoded when the kit receives them. Decoding them a second time is usually harmless, unless, that is, they contain '%'. After the first decoding the '%' character might not be escaping anything valid (depending on what follows it). So a second attempt at decoding might very well fail and throw, since the escape code is invalid. Change-Id: I73d56ce995b0237140a54b6c06bd36bde8b387bd Signed-off-by: Ashod Nakashian --- kit/Kit.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/kit/Kit.cpp b/kit/Kit.cpp index 1db930f06..4edf81d37 100644 --- a/kit/Kit.cpp +++ b/kit/Kit.cpp @@ -1402,9 +1402,8 @@ private: // Append name of the user, if any, who opened the document to rendering options if (!userName.empty()) { - std::string decodedUserName; - URI::decode(userName, decodedUserName); - renderOptsObj->set(".uno:Author", makePropertyValue("string", decodedUserName)); + // userName must be decoded already. + renderOptsObj->set(".uno:Author", makePropertyValue("string", userName)); } if (!spellOnline.empty())