From 3b1b672cfef7c1607c4b4fdc5c022ca4b25fe994 Mon Sep 17 00:00:00 2001 From: bohung Date: Sat, 19 Nov 2022 10:38:49 +0800 Subject: [PATCH] Fix bug. --- app/models/web_link.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/models/web_link.rb b/app/models/web_link.rb index 3853ccb..4211e6a 100644 --- a/app/models/web_link.rb +++ b/app/models/web_link.rb @@ -32,9 +32,10 @@ class WebLink temp_url = {} Site.first.in_use_locales.each do |locale| locale = locale.to_s - temp_url[locale] = self.url_translations[locale] - unless /https?:\/\/[\S]+/.match(self.url_translations[locale]) || self.url_translations[locale].blank? - temp_url[locale] = 'http://' + self.url_translations[locale] + tmp = self.url_translations[locale] + temp_url[locale] = tmp + unless tmp.match(/^http(s|):\/\//) || tmp.blank? || tmp.start_with?('/') + temp_url[locale] = 'http://' + tmp end end self.url_translations = temp_url