trim before stripping tea's comment marker

tea indents its output, so stripping the leading # before trimming left it
there and the page read 'Authenticated as # pastilhas (admin)'.
This commit is contained in:
officer
2026-08-19 10:14:52 +00:00
parent 4a7aa40a28
commit 862512d83a
+3 -1
View File
@@ -176,7 +176,9 @@ export async function testTeaLogin(userId: number): Promise<{ ok: boolean; user?
// around it changes.
const line = out
.split('\n')
.map((l) => l.replace(/^#\s*/, '').trim())
// Trim FIRST: tea indents the line, so stripping the `#` before trimming left it in place and the
// page read "Authenticated as # pastilhas (admin)".
.map((l) => l.trim().replace(/^#\s*/, ''))
.find(Boolean);
return line ? { ok: true, user: line } : { ok: false, error: 'tea answered, but named no account' };
}