Skip to content

Commit fd6ee98

Browse files
committed
escape
1 parent 95d0df9 commit fd6ee98

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

dbos/_sys_db.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1066,7 +1066,7 @@ def get_workflows(
10661066
if input.workflow_id_prefix:
10671067
query = query.where(
10681068
SystemSchema.workflow_status.c.workflow_uuid.startswith(
1069-
input.workflow_id_prefix
1069+
input.workflow_id_prefix, autoescape=True
10701070
)
10711071
)
10721072
if input.queue_name:

tests/test_workflow_introspection.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,27 @@ def simple_workflow() -> None:
198198
assert len(output) == 0, f"Expected list length to be 0, but got {len(output)}"
199199

200200

201+
def test_list_workflow_prefix(dbos: DBOS) -> None:
202+
@DBOS.workflow()
203+
def simple_workflow() -> None:
204+
print("Executed Simple workflow")
205+
return
206+
207+
with SetWorkflowID("test1"):
208+
simple_workflow()
209+
with SetWorkflowID("test_"):
210+
simple_workflow()
211+
212+
output = DBOS.list_workflows(workflow_id_prefix="invalid")
213+
assert len(output) == 0
214+
output = DBOS.list_workflows(workflow_id_prefix="test")
215+
assert len(output) == 2
216+
output = DBOS.list_workflows(workflow_id_prefix="test_")
217+
assert len(output) == 1
218+
output = DBOS.list_workflows(workflow_id_prefix="test1")
219+
assert len(output) == 1
220+
221+
201222
def test_list_workflow_end_times_positive(
202223
dbos: DBOS, skip_with_sqlite_imprecise_time: None
203224
) -> None:

0 commit comments

Comments
 (0)