From e26dc0cdbda13f8b65ab2be3a0e13e7ef5c4b98c Mon Sep 17 00:00:00 2001
From: Chocobozzz <me@florianbigard.com>
Date: Thu, 3 Dec 2020 16:12:58 +0100
Subject: Strict actor url comparison

---
 server/lib/activitypub/actor.ts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'server/lib')

diff --git a/server/lib/activitypub/actor.ts b/server/lib/activitypub/actor.ts
index 63975021c..fb5558ff6 100644
--- a/server/lib/activitypub/actor.ts
+++ b/server/lib/activitypub/actor.ts
@@ -403,7 +403,7 @@ function saveActorAndServerAndModelIfNotExist (
     // Try to fix non HTTPS accounts of remote instances that fixed their URL afterwards
     if (created !== true && actorCreated.url !== actor.url) {
       // Only fix http://example.com/account/djidane to https://example.com/account/djidane
-      if (actorCreated.url.replace('http://', '') !== actor.url.replace('https://', '')) {
+      if (actorCreated.url.replace(/^http:\/\//, '') !== actor.url.replace(/^https:\/\//, '')) {
         throw new Error(`Actor from DB with URL ${actorCreated.url} does not correspond to actor ${actor.url}`)
       }
 
-- 
cgit v1.2.3