forked from firka/flutter
Sanitize host before calling pm (#49591)
This commit is contained in:
@@ -27,6 +27,7 @@ import 'application_package.dart';
|
||||
import 'fuchsia_build.dart';
|
||||
import 'fuchsia_pm.dart';
|
||||
import 'fuchsia_sdk.dart';
|
||||
import 'fuchsia_utils.dart';
|
||||
import 'fuchsia_workflow.dart';
|
||||
import 'tiles_ctl.dart';
|
||||
|
||||
@@ -513,12 +514,7 @@ class FuchsiaDevice extends Device {
|
||||
void clearLogs() {}
|
||||
|
||||
bool get ipv6 {
|
||||
try {
|
||||
Uri.parseIPv6Address(id);
|
||||
return true;
|
||||
} on FormatException {
|
||||
return false;
|
||||
}
|
||||
return isIPv6Address(id);
|
||||
}
|
||||
|
||||
/// List the ports currently running a dart observatory.
|
||||
|
||||
@@ -10,6 +10,7 @@ import '../convert.dart';
|
||||
import '../globals.dart' as globals;
|
||||
|
||||
import 'fuchsia_sdk.dart';
|
||||
import 'fuchsia_utils.dart';
|
||||
|
||||
/// This is a basic wrapper class for the Fuchsia SDK's `pm` tool.
|
||||
class FuchsiaPM {
|
||||
@@ -109,6 +110,9 @@ class FuchsiaPM {
|
||||
if (fuchsiaArtifacts.pm == null) {
|
||||
throwToolExit('Fuchsia pm tool not found');
|
||||
}
|
||||
if (isIPv6Address(host.split('%').first)) {
|
||||
host = '[${host.replaceAll('%', '%25')}]';
|
||||
}
|
||||
final List<String> command = <String>[
|
||||
fuchsiaArtifacts.pm.path,
|
||||
'serve',
|
||||
|
||||
13
packages/flutter_tools/lib/src/fuchsia/fuchsia_utils.dart
Normal file
13
packages/flutter_tools/lib/src/fuchsia/fuchsia_utils.dart
Normal file
@@ -0,0 +1,13 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
/// Returns [true] if [address] is an IPv6 address.
|
||||
bool isIPv6Address(String address) {
|
||||
try {
|
||||
Uri.parseIPv6Address(address);
|
||||
return true;
|
||||
} on FormatException {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user