Skip to content

Commit

Permalink
fix: handle non-UTF-8 endpoint_name (#243)
Browse files Browse the repository at this point in the history
* Update offline_wire_formats.proto

Modify endpoint_name from string to bytes

* Update outbound.rs

"endpoint_name: Some(sys_metrics::host::get_hostname()?.into()),

consumes the newly formatted String and returns a Vec<u8>
  • Loading branch information
SalmonSays authored Nov 20, 2024
1 parent e31f9a2 commit 72d6c71
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion core_lib/src/hdl/outbound.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ impl OutboundRequest {
),
connection_request: Some(location_nearby_connections::ConnectionRequestFrame {
endpoint_id: Some(String::from_utf8_lossy(&self.endpoint_id).to_string()),
endpoint_name: Some(sys_metrics::host::get_hostname()?),
endpoint_name: Some(sys_metrics::host::get_hostname()?.into()),
endpoint_info: Some(
RemoteDeviceInfo {
name: sys_metrics::host::get_hostname()?,
Expand Down
2 changes: 1 addition & 1 deletion core_lib/src/proto_src/offline_wire_formats.proto
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ message ConnectionRequestFrame {
// LINT.ThenChange(//depot/google3/third_party/nearby/proto/connections_enums.proto)

optional string endpoint_id = 1;
optional string endpoint_name = 2;
optional bytes endpoint_name = 2;
optional bytes handshake_data = 3;
// A random number generated for each outgoing connection that is presently
// used to act as a tiebreaker when 2 devices connect to each other
Expand Down

0 comments on commit 72d6c71

Please sign in to comment.