about summary refs log tree commit diff
path: root/spec/services
diff options
context:
space:
mode:
authorMarkus Unterwaditzer <markus@unterwaditzer.net>2023-01-11 21:59:13 +0100
committerGitHub <noreply@github.com>2023-01-11 21:59:13 +0100
commit0c689b9d014324aba5b8751dacec4c0fc20b2038 (patch)
treece2835e33c6014072832a068c4278aca89e5432e /spec/services
parentfd33bcb3b25d3eaf593ade0aa8709a1184fc254e (diff)
fix: allow verification when page size exceeds 1MB (using HTML5 parser) (#22879)
* fix: allow verification when page size exceeds 1MB
Truncates the page after 1MB instead

Closes #15316

* switch to HTML5 parser, fix rubocop errors

* undo rubocop fixes

Co-authored-by: Chris Zubak-Skees <chriszs@gmail.com>
Diffstat (limited to 'spec/services')
-rw-r--r--spec/services/verify_link_service_spec.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/services/verify_link_service_spec.rb b/spec/services/verify_link_service_spec.rb
index 52ba454cc..391560f1c 100644
--- a/spec/services/verify_link_service_spec.rb
+++ b/spec/services/verify_link_service_spec.rb
@@ -73,6 +73,33 @@ RSpec.describe VerifyLinkService, type: :service do
       end
     end
 
+    context 'when a document is truncated but the link back is valid' do
+      let(:html) do
+        "
+          <!doctype html>
+          <body>
+            <a rel=\"me\" href=\"#{ActivityPub::TagManager.instance.url_for(account)}\"
+        "
+      end
+
+      it 'marks the field as not verified' do
+        expect(field.verified?).to be false
+      end
+    end
+
+    context 'when a link back might be truncated' do
+      let(:html) do
+        "
+          <!doctype html>
+          <body>
+            <a rel=\"me\" href=\"#{ActivityPub::TagManager.instance.url_for(account)}"
+      end
+
+      it 'does not mark the field as verified' do
+        expect(field.verified?).to be false
+      end
+    end
+
     context 'when a link does not contain a link back' do
       let(:html) { '' }