Skip to content

Commit 177d712

Browse files
SL-20086 esсape the message text before sending
1 parent 724b6a8 commit 177d712

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

indra/newview/lltranslate.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,7 @@ bool LLAzureTranslationHandler::parseResponse(
725725
return false;
726726
}
727727

728-
translation = first["text"].asString();
728+
translation = LLURI::unescape(first["text"].asString());
729729

730730
return true;
731731
}
@@ -825,8 +825,13 @@ LLSD LLAzureTranslationHandler::sendMessageAndSuspend(LLCoreHttpUtil::HttpCorout
825825
{
826826
LLCore::BufferArray::ptr_t rawbody(new LLCore::BufferArray);
827827
LLCore::BufferArrayStream outs(rawbody.get());
828+
829+
static const std::string allowed_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz "
830+
"0123456789"
831+
"-._~";
832+
828833
outs << "[{\"text\":\"";
829-
outs << msg;
834+
outs << LLURI::escape(msg, allowed_chars);
830835
outs << "\"}]";
831836

832837
return adapter->postRawAndSuspend(request, url, rawbody, options, headers);

0 commit comments

Comments
 (0)