Strip newlines from end of status
This commit is contained in:
parent
86b3a51590
commit
c0123df79a
|
@ -155,7 +155,7 @@ const createStatusController: AppController = async (c) => {
|
||||||
.map(({ data }) => data.find(([name]) => name === 'url')?.[1])
|
.map(({ data }) => data.find(([name]) => name === 'url')?.[1])
|
||||||
.filter((url): url is string => Boolean(url));
|
.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 mediaCompat: string = mediaUrls.length ? ['', '', ...mediaUrls].join('\n') : '';
|
||||||
|
|
||||||
const event = await createEvent({
|
const event = await createEvent({
|
||||||
|
|
|
@ -46,7 +46,7 @@ interface ParsedNoteContent {
|
||||||
/** Convert Nostr content to Mastodon API HTML. Also return parsed data. */
|
/** Convert Nostr content to Mastodon API HTML. Also return parsed data. */
|
||||||
function parseNoteContent(content: string): ParsedNoteContent {
|
function parseNoteContent(content: string): ParsedNoteContent {
|
||||||
// Parsing twice is ineffecient, but I don't know how to do only once.
|
// 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 links = linkify.find(content).filter(isLinkURL);
|
||||||
const firstUrl = links.find(isNonMediaLink)?.href;
|
const firstUrl = links.find(isNonMediaLink)?.href;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue