about summary refs log tree commit diff
path: root/spec/services
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2023-01-24 20:32:31 +0100
committerClaire <claire.github-309c@sitedethib.com>2023-01-24 20:32:31 +0100
commit3074338d79e5e9eb056d810c234e57f14c04c5f9 (patch)
tree3cda43f51dbf40ed742beeac0090b3be08e47c90 /spec/services
parent368d6fe54f94ad2ecd2a1c1e7e5a2359dc37ad30 (diff)
parenta5a00d7f7adff5e0afbd23ac1e1b16120137509a (diff)
Merge branch 'main' into glitch-soc/merge-upstream
Diffstat (limited to 'spec/services')
-rw-r--r--spec/services/verify_link_service_spec.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/services/verify_link_service_spec.rb b/spec/services/verify_link_service_spec.rb
index 391560f1c..8f65f3a84 100644
--- a/spec/services/verify_link_service_spec.rb
+++ b/spec/services/verify_link_service_spec.rb
@@ -150,5 +150,27 @@ RSpec.describe VerifyLinkService, type: :service do
         expect(field.verified?).to be true
       end
     end
+
+    context 'when the link contains a link with a missing protocol slash' do
+      # This was seen in the wild where a user had three pages:
+      # 1. their mastodon profile, which linked to github and the personal website
+      # 2. their personal website correctly linking back to mastodon
+      # 3. a github profile that was linking to the personal website, but with
+      #    a malformed protocol of http:/
+      #
+      # This caused link verification between the mastodon profile and the
+      # website to fail.
+      #
+      # apparently github allows the user to enter website URLs with a single
+      # slash and makes no attempts to correct that.
+      let(:html) { '<a href="http:/unrelated.example">Hello</a>' }
+
+      it 'does not crash' do
+        # We could probably put more effort into perhaps auto-correcting the
+        # link and following it anyway, but at the very least we shouldn't let
+        # exceptions bubble up
+        expect(field.verified?).to be false
+      end
+    end
   end
 end