fix: purify event before publishing to other relays

This commit is contained in:
P. Reis 2024-07-17 11:40:08 -03:00
parent f4f0c5fb86
commit e01e0049e3

View file

@ -14,6 +14,7 @@ import { RelayError } from '@/RelayError.ts';
import { AdminSigner } from '@/signers/AdminSigner.ts'; import { AdminSigner } from '@/signers/AdminSigner.ts';
import { Storages } from '@/storages.ts'; import { Storages } from '@/storages.ts';
import { nostrNow } from '@/utils.ts'; import { nostrNow } from '@/utils.ts';
import { purifyEvent } from '@/storages/hydrate.ts';
const debug = Debug('ditto:api'); const debug = Debug('ditto:api');
@ -152,7 +153,7 @@ async function publishEvent(event: NostrEvent, c: AppContext): Promise<NostrEven
try { try {
await pipeline.handleEvent(event, c.req.raw.signal); await pipeline.handleEvent(event, c.req.raw.signal);
const client = await Storages.client(); const client = await Storages.client();
await client.event(event); await client.event(purifyEvent(event));
} catch (e) { } catch (e) {
if (e instanceof RelayError) { if (e instanceof RelayError) {
throw new HTTPException(422, { throw new HTTPException(422, {