]> cat aescling's git repositories - mastodon.git/commitdiff
Fix OEmbed discovery not handling different URL variants in query (#12439)
authorEugen Rochko <eugen@zeonfederated.com>
Thu, 21 Nov 2019 18:03:07 +0000 (19:03 +0100)
committerGitHub <noreply@github.com>
Thu, 21 Nov 2019 18:03:07 +0000 (19:03 +0100)
Fix #12433

app/services/fetch_oembed_service.rb

index 4f8498c623d926997960faa99a0ec4a516527098..76d971bc51c9922728205bed79c6f2801fecfd4b 100644 (file)
@@ -58,7 +58,7 @@ class FetchOEmbedService
     url_domain = Addressable::URI.parse(@url).normalized_host
 
     endpoint_hash = {
-      endpoint: @endpoint_url.gsub(URI.encode_www_form_component(@url), '{url}'),
+      endpoint: @endpoint_url.gsub(/(=(http[s]?(%3A|:)(\/\/|%2F%2F)))([^&]*)/i, '={url}'),
       format: @format,
     }