Skip to content

Commit

Permalink
fix: introspection bogus child paths (#280)
Browse files Browse the repository at this point in the history
  • Loading branch information
mriemensberger authored May 8, 2024
1 parent f0fc666 commit 7da5d44
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/dbus_fast/message_bus.py
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,9 @@ def _introspect_export_path(self, path: str) -> intr.Node:
continue

child_path = export_path.split(path, maxsplit=1)[1]
if path != "/" and child_path and child_path[0] != "/":
continue

child_path = child_path.lstrip("/")
child_name = child_path.split("/", maxsplit=1)[0]

Expand Down
4 changes: 3 additions & 1 deletion tests/service/test_standard_interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ async def test_introspect_matching_sub_paths():
interface = ExampleInterface("test.interface1")

bus1.export("/a/test/path1", interface)
bus1.export("/a/test/path10", interface)
bus1.export("/a/subpath/a/test/path2", interface)

async def introspect_subpath(path, expected_subnodes):
Expand All @@ -108,8 +109,9 @@ async def introspect_subpath(path, expected_subnodes):

await introspect_subpath("/", {"a"})
await introspect_subpath("/a", {"test", "subpath"})
await introspect_subpath("/a/test", {"path1"})
await introspect_subpath("/a/test", {"path1", "path10"})
await introspect_subpath("/a/test/path1", set())
await introspect_subpath("/a/test/path10", set())
await introspect_subpath("/a/subpath/a/test", {"path2"})
await introspect_subpath("/a/subpath/a/test/path2", set())

Expand Down

0 comments on commit 7da5d44

Please sign in to comment.