From c5554cdf41cacd1cbd709a6deafe7e0be535c5cc Mon Sep 17 00:00:00 2001 From: Jonah Williams Date: Fri, 24 Apr 2020 21:35:23 -0700 Subject: [PATCH] [flutter_tools] remove trailing eth info from fuchsia package server (#55617) --- .../flutter_tools/lib/src/fuchsia/fuchsia_pm.dart | 12 +++++++++++- .../test/general.shard/fuchsia/fuchsia_pm_test.dart | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/flutter_tools/lib/src/fuchsia/fuchsia_pm.dart b/packages/flutter_tools/lib/src/fuchsia/fuchsia_pm.dart index 82792e7730a..ed791bd8f6b 100644 --- a/packages/flutter_tools/lib/src/fuchsia/fuchsia_pm.dart +++ b/packages/flutter_tools/lib/src/fuchsia/fuchsia_pm.dart @@ -180,7 +180,17 @@ class FuchsiaPM { /// server.stop(); /// } class FuchsiaPackageServer { - FuchsiaPackageServer(this._repo, this.name, this._host, this._port); + factory FuchsiaPackageServer(String repo, String name, String host, int port) { + // TODO(jonahwilliams): ensure we only receive valid ipv4 or ipv6 InternetAddresses. + // Temporary work around to receiving ipv6 addresses with trailing information: + // fe80::ec4:7aff:fecc:ea8f%eno2 + if (host.contains('%')) { + host = host.split('%').first; + } + return FuchsiaPackageServer._(repo, name, host, port); + } + + FuchsiaPackageServer._(this._repo, this.name, this._host, this._port); static const String deviceHost = 'fuchsia.com'; static const String toolHost = 'flutter_tool'; diff --git a/packages/flutter_tools/test/general.shard/fuchsia/fuchsia_pm_test.dart b/packages/flutter_tools/test/general.shard/fuchsia/fuchsia_pm_test.dart index c29915b94b8..f95be6e19c6 100644 --- a/packages/flutter_tools/test/general.shard/fuchsia/fuchsia_pm_test.dart +++ b/packages/flutter_tools/test/general.shard/fuchsia/fuchsia_pm_test.dart @@ -78,7 +78,7 @@ void main() { expect( FuchsiaPackageServer('a', 'b', host, port).url, - 'http://[fe80::ec4:7aff:fecc:ea8f%25eno2]:23', + 'http://[fe80::ec4:7aff:fecc:ea8f]:23', ); }); });