From 6358dc237d172f9d2f6bb8cd515291412877f018 Mon Sep 17 00:00:00 2001 From: Niko Diamadis Date: Sun, 5 Jan 2025 11:07:24 -0500 Subject: [PATCH] style: replace substring expressions with RegEx Co-authored-by: chris48s --- services/mastodon/mastodon-follow.service.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/services/mastodon/mastodon-follow.service.js b/services/mastodon/mastodon-follow.service.js index 19c7ed93801bf..ba601c8ad6246 100644 --- a/services/mastodon/mastodon-follow.service.js +++ b/services/mastodon/mastodon-follow.service.js @@ -70,11 +70,7 @@ export default class MastodonFollow extends BaseJsonService { async handle({ id }, { domain = 'mastodon.social' }) { if (isNaN(id)) throw new NotFound({ prettyMessage: 'invalid user id format' }) - if (domain.startsWith('https://')) { - domain = domain.substring(8) - } else if (domain.startsWith('http://')) { - domain = domain.substring(7) - } + domain = domain.replace(/^https?:\/\//, '') const data = await this.fetch({ id, domain }) return this.constructor.render({ username: data.username,