bug: tryParseNostrLink

This commit is contained in:
2023-06-13 14:46:16 +01:00
parent fdf3d855df
commit 7992601f46
6 changed files with 18 additions and 20 deletions

View File

@ -2,7 +2,7 @@ import { EventKind, HexKey, NostrPrefix, NostrEvent } from ".";
import { HashtagRegex } from "./Const";
import { getPublicKey, unixNow } from "./Utils";
import { EventExt } from "./EventExt";
import { parseNostrLink } from "./NostrLink";
import { tryParseNostrLink } from "./NostrLink";
export class EventBuilder {
#kind?: EventKind;
@ -90,7 +90,7 @@ export class EventBuilder {
#replaceMention(match: string) {
const npub = match.slice(1);
const link = parseNostrLink(npub);
const link = tryParseNostrLink(npub);
if (link) {
if (link.type === NostrPrefix.Profile || link.type === NostrPrefix.PublicKey) {
this.tag(["p", link.id]);