| 106 | } |
| 107 | |
| 108 | absl::StatusOr<std::string> GetBinary(absl::string_view yaml, |
| 109 | const YAML::Node& node) { |
| 110 | if (!node.IsDefined() || !node.IsScalar() || !IsBinary(node)) { |
| 111 | return ""; |
| 112 | } |
| 113 | std::string binary; |
| 114 | // Instead of using the YAML::Binary type, we use absl::Base64Unescape |
| 115 | // because YAML::Binary is lenient to Base64 decoding errors. |
| 116 | if (absl::Base64Unescape(GetString(yaml, node), &binary)) { |
| 117 | return binary; |
| 118 | } else { |
| 119 | return YamlError(yaml, node, |
| 120 | "Node '" + GetString(yaml, node) + |
| 121 | "' is not a valid Base64 encoded binary"); |
| 122 | } |
| 123 | } |
| 124 | |
| 125 | absl::StatusOr<bool> GetBool(absl::string_view yaml, absl::string_view key, |
| 126 | const YAML::Node& node) { |
no test coverage detected