diff --git a/lib/pretty_text.rb b/lib/pretty_text.rb index 05df311c5bf..66d9c96dfae 100644 --- a/lib/pretty_text.rb +++ b/lib/pretty_text.rb @@ -527,7 +527,7 @@ module PrettyText if iframe["data-original-href"].present? vimeo_url = UrlHelper.normalized_encode(iframe["data-original-href"]) else - vimeo_id = iframe["src"].split("/").last + vimeo_id = iframe["src"].split("/").last.sub("?h=", "/") vimeo_url = "https://vimeo.com/#{vimeo_id}" end iframe.replace Nokogiri::HTML5.fragment("
") diff --git a/spec/lib/pretty_text_spec.rb b/spec/lib/pretty_text_spec.rb index 7b3ef983203..737ce0f198d 100644 --- a/spec/lib/pretty_text_spec.rb +++ b/spec/lib/pretty_text_spec.rb @@ -1298,6 +1298,14 @@ RSpec.describe PrettyText do ) end + it "creates a valid URL when data-original-href is missing from Vimeo link" do + html = + '' + expect(PrettyText.format_for_email(html, post)).to match( + "https://vimeo.com/508864124/fcbbcc92fa", + ) + end + describe "#convert_vimeo_iframes" do it "converts