mirror of
https://github.com/mastodon/mastodon.git
synced 2024-08-20 21:08:15 -07:00
Don't capture scheme-less URLs in the status (#5435)
Specifically, this fixes status length calculation to be same as JS side. BTW, since this pattern used in not only preview card fetching, we should extract it (with twitter-regex?) and write tests I think.
This commit is contained in:
parent
a02de9e012
commit
3bc8924940
1 changed files with 1 additions and 1 deletions
|
@ -3,7 +3,7 @@
|
||||||
class FetchLinkCardService < BaseService
|
class FetchLinkCardService < BaseService
|
||||||
URL_PATTERN = %r{
|
URL_PATTERN = %r{
|
||||||
( # $1 URL
|
( # $1 URL
|
||||||
(https?:\/\/)? # $2 Protocol (optional)
|
(https?:\/\/) # $2 Protocol (required)
|
||||||
(#{Twitter::Regex[:valid_domain]}) # $3 Domain(s)
|
(#{Twitter::Regex[:valid_domain]}) # $3 Domain(s)
|
||||||
(?::(#{Twitter::Regex[:valid_port_number]}))? # $4 Port number (optional)
|
(?::(#{Twitter::Regex[:valid_port_number]}))? # $4 Port number (optional)
|
||||||
(/#{Twitter::Regex[:valid_url_path]}*)? # $5 URL Path and anchor
|
(/#{Twitter::Regex[:valid_url_path]}*)? # $5 URL Path and anchor
|
||||||
|
|
Loading…
Reference in a new issue