if the host does not include the protocol, add it (https)
did
committed Sep 22, 2015
commit 05d0e796db8963f5bd3ddce125810f2e7531e1e7
Showing 2
changed files with
8 additions
and 1 deletions
locomotive/steam/services/asset_host_service.rb b/lib/locomotive/steam/services/asset_host_service.rb
+1
-1
| @@ | @@ -30,7 +30,7 @@ module Locomotive |
| if host.respond_to?(:call) | |
| host.call(request, site) | |
| else | |
| - | host |
| + | host =~ Steam::IsHTTP ? host : "https://#{host}" |
| end | |
| else | |
| nil | |
spec/unit/services/asset_host_service_spec.rb
+7
-0
| @@ | @@ -50,6 +50,13 @@ describe Locomotive::Steam::AssetHostService do |
| let(:host) { 'http://assets.locomotivecms.com' } | |
| it { is_expected.to eq 'http://assets.locomotivecms.com/sites/42/assets/1/banner.png' } | |
| + | context 'without the protocol' do |
| + | |
| + | let(:host) { 's3-us-east-1.amazonaws.com' } |
| + | it { is_expected.to eq 'https://s3-us-east-1.amazonaws.com/sites/42/assets/1/banner.png' } |
| + | |
| + | end |
| + | |
| end | |
| describe 'the host is a block' do | |