fix(workflows): unregister missing yaml on trash

Ghost register entries returned 404 on delete and stayed in the list. Unregister first so move-to-trash still removes them when the file is gone.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-23 09:17:10 +07:00
co-authored by Cursor
parent dd98421b08
commit e2e70a5aad
3 changed files with 45 additions and 14 deletions
+7 -8
View File
@@ -706,15 +706,14 @@ export default function workflowsPluginFactory(registry) {
return reply.code(err.statusCode ?? 400).send({ error: err.message });
}
const raw = fsStore.readWorkflowYaml(owner, file);
if (raw == null) {
return reply.code(404).send({ error: "workflow not found" });
}
let name = null;
try {
const parsed = yaml.parse(raw);
name = parsed?.name ?? null;
} catch {
// ignore
if (raw != null) {
try {
const parsed = yaml.parse(raw);
name = parsed?.name ?? null;
} catch {
// ignore
}
}
try {
const item = await moveWorkflowToTrash({