mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
Test and fix parsing of URLs
This commit is contained in:
parent
7a2a8bd4f5
commit
ba77787767
2 changed files with 7 additions and 2 deletions
|
|
@ -11,10 +11,15 @@ Deno.test('parseNoteContent', () => {
|
|||
});
|
||||
|
||||
Deno.test('parseNoteContent parses URLs', () => {
|
||||
const { html } = parseNoteContent(`check out my website: https://alexgleason.me`, []);
|
||||
const { html } = parseNoteContent('check out my website: https://alexgleason.me', []);
|
||||
assertEquals(html, 'check out my website: <a href="https://alexgleason.me">https://alexgleason.me</a>');
|
||||
});
|
||||
|
||||
Deno.test('parseNoteContent parses bare URLs', () => {
|
||||
const { html } = parseNoteContent('have you seen ditto.pub?', []);
|
||||
assertEquals(html, 'have you seen <a href="http://ditto.pub">ditto.pub</a>?');
|
||||
});
|
||||
|
||||
Deno.test('parseNoteContent parses mentions with apostrophes', () => {
|
||||
const { html } = parseNoteContent(
|
||||
`did you see nostr:nprofile1qqsqgc0uhmxycvm5gwvn944c7yfxnnxm0nyh8tt62zhrvtd3xkj8fhgprdmhxue69uhkwmr9v9ek7mnpw3hhytnyv4mz7un9d3shjqgcwaehxw309ahx7umywf5hvefwv9c8qtmjv4kxz7gpzemhxue69uhhyetvv9ujumt0wd68ytnsw43z7s3al0v's speech?`,
|
||||
|
|
|
|||
|
|
@ -52,8 +52,8 @@ function parseNoteContent(content: string, mentions: MastodonMention[]): ParsedN
|
|||
return html`<span class="h-card"><a class="u-url mention" href="${href}" rel="ugc">@<span>${name}</span></a></span>${extra}`;
|
||||
}
|
||||
}
|
||||
return content;
|
||||
}
|
||||
return content;
|
||||
} catch {
|
||||
// fallthrough
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue