Skip to content

Commit 059c860

Browse files
committed
use the file system path context
1 parent 09c61c1 commit 059c860

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pkgs/dart_mcp_server/lib/src/utils/cli_utils.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import 'dart:async';
77
import 'package:collection/collection.dart';
88
import 'package:dart_mcp/server.dart';
99
import 'package:file/file.dart';
10-
import 'package:path/path.dart' as p;
1110
import 'package:process/process.dart';
1211
import 'package:yaml/yaml.dart';
1312

@@ -283,10 +282,11 @@ bool _isUnderRoot(Root root, String uri, FileSystem fileSystem) {
283282
}
284283
// Canonicalizing the paths handles any `../` segments and also deals with
285284
// trailing slashes versus no trailing slashes.
286-
final canonicalRootPath = p.canonicalize(rootUri.path);
287-
final canonicalUriPath = p.canonicalize(resolvedUri.path);
285+
286+
final canonicalRootPath = fileSystem.path.canonicalize(rootUri.path);
287+
final canonicalUriPath = fileSystem.path.canonicalize(resolvedUri.path);
288288
return canonicalRootPath == canonicalUriPath ||
289-
canonicalUriPath.startsWith(canonicalRootPath);
289+
fileSystem.path.isWithin(canonicalRootPath, canonicalUriPath);
290290
}
291291

292292
/// The schema for the `roots` parameter for any tool that accepts it.

0 commit comments

Comments
 (0)