Skip to content

Commit 3e1de4c

Browse files
#48 Fix escape of common special chars in parent names to prevent query errors
1 parent 3f5b69c commit 3e1de4c

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

etc/js/components/widgets/tree/entity-subtree.vue

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<template>
22
<div class="entity-subtree">
3-
<entity-tree-item
4-
:conn="conn"
5-
:item="item"
3+
<entity-tree-item
4+
:conn="conn"
5+
:item="item"
66
:depth="depth"
77
:selectedItem="selectedItem"
88
v-for="item in treeQueryResult"
@@ -58,15 +58,15 @@ function updateQuery() {
5858
}
5959
6060
let q = `
61-
[none] ?flecs.core.Module,
61+
[none] ?flecs.core.Module,
6262
[none] ?flecs.core.Component,
6363
[none] ?flecs.core.Relationship,
6464
[none] ?flecs.core.Trait,
6565
[none] ?flecs.core.Target,
6666
[none] ?flecs.core.Query,
67-
[none] ?flecs.core.Prefab,
68-
[none] ?flecs.core.Disabled,
69-
[none] ?flecs.core.ChildOf(_, $this),
67+
[none] ?flecs.core.Prefab,
68+
[none] ?flecs.core.Disabled,
69+
[none] ?flecs.core.ChildOf(_, $this),
7070
[none] ?flecs.core.IsA($this, $base|self)`
7171
;
7272
@@ -76,8 +76,8 @@ function updateQuery() {
7676
if (!nf && !qf) {
7777
let path = props.path;
7878
if (path) {
79-
path = path.replaceAll(" ", "\\ ");
80-
q += `, (flecs.core.ChildOf, ${path})`;
79+
const escapedPath = path.replace(/([ ():\-])/g, '\\$1');
80+
q += `, (flecs.core.ChildOf, ${escapedPath})`;
8181
}
8282
}
8383
@@ -93,11 +93,11 @@ function updateQuery() {
9393
}
9494
}
9595
96-
treeQuery.value =
96+
treeQuery.value =
9797
props.conn.query(q, {
98-
try: true,
99-
rows: true,
100-
limit: 1000,
98+
try: true,
99+
rows: true,
100+
limit: 1000,
101101
doc: true,
102102
managed: true,
103103
persist: props.path === "0" // persist root query across reconnects

0 commit comments

Comments
 (0)