Strip newlines from end of status

This commit is contained in:
Alex Gleason 2024-05-30 12:03:01 -05:00
parent 86b3a51590
commit c0123df79a
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
2 changed files with 2 additions and 2 deletions

View File

@ -155,7 +155,7 @@ const createStatusController: AppController = async (c) => {
.map(({ data }) => data.find(([name]) => name === 'url')?.[1])
.filter((url): url is string => Boolean(url));
const quoteCompat = data.quote_id ? `\n\n${nip19.noteEncode(data.quote_id)}` : '';
const quoteCompat = data.quote_id ? `\n\nnostr:${nip19.noteEncode(data.quote_id)}` : '';
const mediaCompat: string = mediaUrls.length ? ['', '', ...mediaUrls].join('\n') : '';
const event = await createEvent({

View File

@ -46,7 +46,7 @@ interface ParsedNoteContent {
/** Convert Nostr content to Mastodon API HTML. Also return parsed data. */
function parseNoteContent(content: string): ParsedNoteContent {
// Parsing twice is ineffecient, but I don't know how to do only once.
const html = linkifyStr(content, linkifyOpts);
const html = linkifyStr(content, linkifyOpts).replace(/\n+$/, '');
const links = linkify.find(content).filter(isLinkURL);
const firstUrl = links.find(isNonMediaLink)?.href;