Merge commit 'b85c387c5c0527b0ad31c27031a09d361826c5fc' into glitch-soc/merge-upstream

Conflicts:
- `config/initializers/content_security_policy.rb`:
  Kept our version, it was not affected by upstream's bug.
This commit is contained in:
Claire
2023-06-10 16:48:01 +02:00
178 changed files with 1616 additions and 1109 deletions

View File

@ -77,8 +77,8 @@ class BackupService < BaseService
path = m.file&.path
next unless path
path = path.gsub(/\A.*\/system\//, '')
path = path.gsub(/\A\/+/, '')
path = path.gsub(%r{\A.*/system/}, '')
path = path.gsub(%r{\A/+}, '')
download_to_zip(zipfile, m.file, path)
end

View File

@ -7,7 +7,7 @@ class FetchLinkCardService < BaseService
URL_PATTERN = %r{
(#{Twitter::TwitterText::Regex[:valid_url_preceding_chars]}) # $1 preceding chars
( # $2 URL
(https?:\/\/) # $3 Protocol (required)
(https?://) # $3 Protocol (required)
(#{Twitter::TwitterText::Regex[:valid_domain]}) # $4 Domain(s)
(?::(#{Twitter::TwitterText::Regex[:valid_port_number]}))? # $5 Port number (optional)
(/#{Twitter::TwitterText::Regex[:valid_url_path]}*)? # $6 URL Path and anchor

View File

@ -2,7 +2,7 @@
class FetchOEmbedService
ENDPOINT_CACHE_EXPIRES_IN = 24.hours.freeze
URL_REGEX = /(=(http[s]?(%3A|:)(\/\/|%2F%2F)))([^&]*)/i
URL_REGEX = %r{(=(https?(%3A|:)(//|%2F%2F)))([^&]*)}i
attr_reader :url, :options, :format, :endpoint_url

View File

@ -70,7 +70,7 @@ class SearchService < BaseService
end
def url_query?
@resolve && /\Ahttps?:\/\//.match?(@query)
@resolve && %r{\Ahttps?://}.match?(@query)
end
def url_resource_results