From f7b1f3ad6df4d9a9971ae854e6c5bdcc59cee745 Mon Sep 17 00:00:00 2001 From: CommanderRoot Date: Fri, 25 Mar 2022 19:57:42 +0100 Subject: [PATCH] refactor: replace deprecated String.prototype.substr() (#3285) .substr() is deprecated so we replace it with .slice() which works similarily but isn't deprecated Signed-off-by: Tobias Speicher --- server/routes/api/hooks.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/routes/api/hooks.ts b/server/routes/api/hooks.ts index 22e70cd0d..216b049d7 100644 --- a/server/routes/api/hooks.ts +++ b/server/routes/api/hooks.ts @@ -57,7 +57,7 @@ router.post("hooks.unfurl", async (ctx) => { const unfurls = {}; for (const link of event.links) { - const id = link.url.substr(link.url.lastIndexOf("/") + 1); + const id = link.url.slice(link.url.lastIndexOf("/") + 1); const doc = await Document.findByPk(id); if (!doc || doc.teamId !== user.teamId) { continue;