This website works better with JavaScript.
Home
Explore
Help
Sign In
nekobus
/
mastodon_neko
forked from
closed-social/mastodon
Watch
1
Star
0
Fork
0
Code
Issues
0
Pull Requests
0
Projects
0
Releases
0
Wiki
Activity
Browse Source
Fix failed profile verification when rel attribute including values other than me (
#8733
)
master
Yamagishi Kazutoshi
6 years ago
committed by
Eugen Rochko
parent
d149c2dc78
commit
3da1cc7d5e
2 changed files
with
16 additions
and
1 deletions
Split View
Diff Options
Show Stats
Download Patch File
Download Diff File
+1
-1
app/services/verify_link_service.rb
+15
-0
spec/services/verify_link_service_spec.rb
+ 1
- 1
app/services/verify_link_service.rb
View File
@ -27,6 +27,6 @@ class VerifyLinkService < BaseService
def
link_back_present?
return
false
if
@body
.
empty?
Nokogiri
::
HTML
(
@body
)
.
xpath
(
'//a[
@rel="me"]|//link[@rel="me"
]'
)
.
any?
{
|
link
|
link
[
'href'
]
==
@link_back
}
Nokogiri
::
HTML
(
@body
)
.
xpath
(
'//a[
contains(concat(" ", normalize-space(@rel), " "), " me ")]|//link[contains(concat(" ", normalize-space(@rel), " "), " me ")
]'
)
.
any?
{
|
link
|
link
[
'href'
]
==
@link_back
}
end
end
+ 15
- 0
spec/services/verify_link_service_spec.rb
View File
@ -26,6 +26,21 @@ RSpec.describe VerifyLinkService, type: :service do
end
end
context
'when a link contains an <a rel="noopener"> back'
do
let
(
:html
)
do
<<
-
HTML
<
!
doctype
html
>
<
body
>
<
a
href
=
"
#{
ActivityPub
::
TagManager
.
instance
.
url_for
(
account
)
}
"
rel
=
"
noopener me
"
target
=
"
_blank
"
>
Follow
me
on
Mastodon
<
/
a>
<
/
body>
HTML
end
it
'marks the field as verified'
do
expect
(
field
.
verified?
)
.
to
be
true
end
end
context
'when a link contains a <link> back'
do
let
(
:html
)
do
<<
-
HTML
Write
Preview
Loading…
Cancel
Save