fedimbed: fix where its actually crashing and also slight optimization
This commit is contained in:
parent
6bff2e9eb3
commit
99510766d4
1 changed files with 7 additions and 2 deletions
|
@ -724,10 +724,15 @@ events.add("messageCreate", "fedimbed", async function (msg) {
|
|||
.trim()
|
||||
.replace("@\u200b", "@")
|
||||
.replace("@%E2%80%8B", "@");
|
||||
let urlObj;
|
||||
try {
|
||||
urlObj = new URL(url);
|
||||
} catch {
|
||||
// noop
|
||||
}
|
||||
for (const service of Object.keys(PATH_REGEX)) {
|
||||
const regex = PATH_REGEX[service];
|
||||
const urlObj = new URL(url);
|
||||
if (regex.test(urlObj.pathname)) {
|
||||
if (urlObj && regex.test(urlObj.pathname)) {
|
||||
logger.verbose(
|
||||
"fedimbed",
|
||||
`Hit "${service}" for "${url}", processing now.`
|
||||
|
|
Loading…
Reference in a new issue