Skip to content

Commit

Permalink
comment
Browse files Browse the repository at this point in the history
Signed-off-by: Alyssa Wilk <[email protected]>
  • Loading branch information
alyssawilk committed Mar 28, 2024
1 parent fc9c036 commit 78891d0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions source/common/protobuf/utility.cc
Original file line number Diff line number Diff line change
Expand Up @@ -852,25 +852,26 @@ void MessageUtil::loadFromFile(const std::string& path, Protobuf::Message& messa
return;
}

#ifdef ENVOY_ENABLE_YAML
// If the filename ends with .pb_text, attempt to parse it as a text proto.
if (absl::EndsWithIgnoreCase(path, FileExtensions::get().ProtoText)) {
#endif
#if defined(ENVOY_ENABLE_FULL_PROTOS)
if (Protobuf::TextFormat::ParseFromString(contents, &message)) {
return;
}
#endif
throwEnvoyExceptionOrPanic("Unable to parse file \"" + path + "\" as a text protobuf (type " +
message.GetTypeName() + ")");
#ifdef ENVOY_ENABLE_YAML
}
#ifdef ENVOY_ENABLE_YAML
if (absl::EndsWithIgnoreCase(path, FileExtensions::get().Yaml) ||
absl::EndsWithIgnoreCase(path, FileExtensions::get().Yml)) {
loadFromYaml(contents, message, validation_visitor);
} else {
loadFromJson(contents, message, validation_visitor);
}
#else
throwEnvoyExceptionOrPanic("Unable to parse file \"" + path + "\" (type " +
message.GetTypeName() + ")");
#endif
}

Expand Down

0 comments on commit 78891d0

Please sign in to comment.