diff --git a/app/models/enterprise.rb b/app/models/enterprise.rb index 9ef3176274..789884ce54 100644 --- a/app/models/enterprise.rb +++ b/app/models/enterprise.rb @@ -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 diff --git a/spec/system/admin/enterprises_spec.rb b/spec/system/admin/enterprises_spec.rb index 6b59886dfa..58e68d34f8 100644 --- a/spec/system/admin/enterprises_spec.rb +++ b/spec/system/admin/enterprises_spec.rb @@ -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