Skip to content

Commit

Permalink
Trim ECH config list with folly::trimWhitespace
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Nick Richardson authored and facebook-github-bot committed Jan 23, 2024
1 parent 03516ec commit 62d487e
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions fizz/tool/FizzCommandCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,8 @@ folly::Optional<folly::dynamic> readECHConfigsJson(std::string echFile) {
folly::Optional<ech::ECHConfigList> parseECHConfigsBase64(
std::string echConfigListBase64) {
std::vector<ech::ECHConfig> 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<ech::ECHConfigList>(cursor);
}
Expand Down

0 comments on commit 62d487e

Please sign in to comment.