mirror of
https://github.com/mastodon/mastodon.git
synced 2025-07-18 02:08:16 +00:00
Compare commits
3 Commits
b8d057b87f
...
a0d3757532
Author | SHA1 | Date | |
---|---|---|---|
![]() |
a0d3757532 | ||
![]() |
74fc4dbacf | ||
![]() |
65f6fba745 |
|
@ -2848,7 +2848,6 @@ a.account__display-name {
|
||||||
&__pane {
|
&__pane {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
pointer-events: none;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
min-width: 285px;
|
min-width: 285px;
|
||||||
|
@ -2860,7 +2859,6 @@ a.account__display-name {
|
||||||
&__inner {
|
&__inner {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
width: 285px;
|
width: 285px;
|
||||||
pointer-events: auto;
|
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,11 +2,27 @@
|
||||||
|
|
||||||
module Extractor
|
module Extractor
|
||||||
MAX_DOMAIN_LENGTH = 253
|
MAX_DOMAIN_LENGTH = 253
|
||||||
|
MAX_URL_LENGTH = 4096
|
||||||
|
|
||||||
extend Twitter::TwitterText::Extractor
|
extend Twitter::TwitterText::Extractor
|
||||||
|
|
||||||
module_function
|
module_function
|
||||||
|
|
||||||
|
def is_valid_domain(url_length, domain, protocol)
|
||||||
|
begin
|
||||||
|
raise ArgumentError.new("invalid empty domain") unless domain
|
||||||
|
original_domain_length = domain.length
|
||||||
|
encoded_domain = IDN::Idna.toASCII(domain, IDN::Idna::ALLOW_UNASSIGNED)
|
||||||
|
updated_domain_length = encoded_domain.length
|
||||||
|
url_length += (updated_domain_length - original_domain_length) if (updated_domain_length > original_domain_length)
|
||||||
|
url_length += URL_PROTOCOL_LENGTH unless protocol
|
||||||
|
url_length <= MAX_URL_LENGTH
|
||||||
|
# On error don't consider this a valid domain.
|
||||||
|
rescue Exception
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def extract_entities_with_indices(text, options = {}, &block)
|
def extract_entities_with_indices(text, options = {}, &block)
|
||||||
entities = extract_urls_with_indices(text, options) +
|
entities = extract_urls_with_indices(text, options) +
|
||||||
extract_hashtags_with_indices(text, check_url_overlap: false) +
|
extract_hashtags_with_indices(text, check_url_overlap: false) +
|
||||||
|
|
Loading…
Reference in New Issue
Block a user