do not append the asset host to the source if the source is blank (nil or empty)
did
committed Sep 14, 2016
commit 2bcdcaa84223e65972d3794dab880794a9cfa45d
Showing 3
changed files with
9 additions
and 2 deletions
locomotive/steam/liquid/tags/editable/file.rb b/lib/locomotive/steam/liquid/tags/editable/file.rb
+1
-1
| @@ | @@ -59,7 +59,7 @@ module Locomotive |
| end | |
| # in the live editing mode, tag all the images with their editable path (block + slug) | |
| - | if editable?(context) |
| + | if editable?(context) && !url.blank? |
| url = url + (url.include?('?') ? '&' : '?') + 'editable-path=' + @path | |
| end | |
locomotive/steam/services/asset_host_service.rb b/lib/locomotive/steam/services/asset_host_service.rb
+1
-1
| @@ | @@ -12,7 +12,7 @@ module Locomotive |
| end | |
| def compute(source, timestamp = nil) | |
| - | return source if source.nil? |
| + | return source if source.blank? |
| timestamp ||= (site.try(:template_version) || site.try(:updated_at)).to_i | |
spec/unit/services/asset_host_service_spec.rb
+7
-0
| @@ | @@ -65,6 +65,13 @@ describe Locomotive::Steam::AssetHostService do |
| end | |
| + | context 'the source is an empty string' do |
| + | |
| + | let(:source) { '' } |
| + | it { is_expected.to eq '' } |
| + | |
| + | end |
| + | |
| end | |
| describe 'the host is a block' do | |