From 62d487eb27948c23f65a1132a60d3e94795a326d Mon Sep 17 00:00:00 2001 From: Nick Richardson Date: Tue, 23 Jan 2024 09:21:23 -0800 Subject: [PATCH] Trim ECH config list with folly::trimWhitespace Summary: Replaces code to trim whitespace on ECH config list with folly's trimWhitespace implementation. Reviewed By: knekritz Differential Revision: D52959607 fbshipit-source-id: 65ee7d6d92f361f3ba5c397bd0151b43e3e1bd6e --- fizz/tool/FizzCommandCommon.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/fizz/tool/FizzCommandCommon.cpp b/fizz/tool/FizzCommandCommon.cpp index b4d188cc2fe..ae49411a99e 100644 --- a/fizz/tool/FizzCommandCommon.cpp +++ b/fizz/tool/FizzCommandCommon.cpp @@ -173,11 +173,8 @@ folly::Optional readECHConfigsJson(std::string echFile) { folly::Optional parseECHConfigsBase64( std::string echConfigListBase64) { std::vector echConfigs; - echConfigListBase64.erase( - std::remove(echConfigListBase64.begin(), echConfigListBase64.end(), '\n'), - echConfigListBase64.cend()); - auto configBuf = - folly::IOBuf::copyBuffer(folly::base64Decode(echConfigListBase64)); + auto configBuf = folly::IOBuf::copyBuffer( + folly::base64Decode(folly::trimWhitespace(echConfigListBase64))); folly::io::Cursor cursor(configBuf.get()); return decode(cursor); }