Fixes #60
This commit is contained in:
parent
69ec24ee2d
commit
0272e0c4f0
@ -58,8 +58,12 @@ export async function titleUnfurlOptions(url: string): Promise<UnfurlOption[]> {
|
|||||||
// Run on the server because plugs will likely rely on fetch for this
|
// Run on the server because plugs will likely rely on fetch for this
|
||||||
export async function unfurlExec(id: string, url: string): Promise<string> {
|
export async function unfurlExec(id: string, url: string): Promise<string> {
|
||||||
let replacement = await dispatchEvent(`unfurl:${id}`, url);
|
let replacement = await dispatchEvent(`unfurl:${id}`, url);
|
||||||
|
if (replacement.length === 0) {
|
||||||
|
throw new Error("Unfurl failed");
|
||||||
|
} else {
|
||||||
return replacement[0];
|
return replacement[0];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const titleRegex = /<title[^>]*>\s*([^<]+)\s*<\/title\s*>/i;
|
const titleRegex = /<title[^>]*>\s*([^<]+)\s*<\/title\s*>/i;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user