Add http to white label logo link if this do not start with http

This commit is contained in:
Jean-Baptiste Bellet
2023-06-01 17:36:59 +02:00
parent ced8f8aa58
commit 880ba85791
2 changed files with 10 additions and 0 deletions

View File

@@ -317,6 +317,14 @@ class Enterprise < ApplicationRecord
)
end
def white_label_logo_link
return nil if self[:white_label_logo_link].blank?
return self[:white_label_logo_link] if self[:white_label_logo_link].start_with?('http')
"http://#{self[:white_label_logo_link]}"
end
def website
strip_url self[:website]
end

View File

@@ -710,6 +710,8 @@ describe '
context "can edit white label logo link" do
it_behaves_like "edit link with", "https://www.openfoodnetwork.org", "https://www.openfoodnetwork.org"
it_behaves_like "edit link with", "www.openfoodnetwork.org", "http://www.openfoodnetwork.org"
it_behaves_like "edit link with", "openfoodnetwork.org", "http://openfoodnetwork.org"
end
end