From 1c81dd02c5d4411dadb82a85200c8c532a7d2ec5 Mon Sep 17 00:00:00 2001 From: Adrian Hinz Date: Sat, 22 Oct 2022 16:10:14 +0200 Subject: [PATCH] fix for youtube src --- app/models/dotation.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/models/dotation.rb b/app/models/dotation.rb index 416264b..3e02b4b 100644 --- a/app/models/dotation.rb +++ b/app/models/dotation.rb @@ -177,7 +177,12 @@ class Dotation < ApplicationRecord ret = full_descr doc = Nokogiri::HTML(ret) doc.css('iframe').each do |iframe| - url = 'https:' + iframe['src'] + if iframe['src'].include? 'https' + url = iframe['src'] + else + url = 'https:' + iframe['src'] + end + new_node = doc.create_element 'a' new_node['href'] = url new_node.inner_html = url