diff options
author | Starfall <us@starfall.systems> | 2023-04-14 19:22:47 -0500 |
---|---|---|
committer | Starfall <us@starfall.systems> | 2023-04-14 19:22:47 -0500 |
commit | 4fe1689de43f4404eb9530fcfbcbfb26d6c1c13a (patch) | |
tree | 6811b845bb7f4966b10dcefa3dea404246f161c7 /spec/services/verify_link_service_spec.rb | |
parent | 65c1e53a32cabcdbb7bca57002bb0f6acdebe07e (diff) | |
parent | bed63f6dae0879ac840066b031229e0d139089cd (diff) |
Diffstat (limited to 'spec/services/verify_link_service_spec.rb')
-rw-r--r-- | spec/services/verify_link_service_spec.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/services/verify_link_service_spec.rb b/spec/services/verify_link_service_spec.rb index 391560f1c..ea9ccc3fc 100644 --- a/spec/services/verify_link_service_spec.rb +++ b/spec/services/verify_link_service_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'rails_helper' RSpec.describe VerifyLinkService, type: :service do @@ -150,5 +152,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 |