Commit 1de26447 authored by Ahmad Sherif's avatar Ahmad Sherif

Exclude snippets from external caching handling

Fixes https://gitlab.com/gitlab-org/gitlab/issues/193498

Proper handling would be tackled separately in
https://gitlab.com/gitlab-org/gitlab/issues/194118.
parent 62052283
......@@ -198,7 +198,7 @@ module ApplicationHelper
end
def external_storage_url_or_path(path, project = @project)
return path unless static_objects_external_storage_enabled?
return path if @snippet || !static_objects_external_storage_enabled?
uri = URI(Gitlab::CurrentSettings.static_objects_external_storage_url)
path = URI(path) # `path` could have query parameters, so we need to split query and path apart
......
---
title: Exclude snippets from external caching handling
merge_request:
author:
type: fixed
......@@ -206,6 +206,15 @@ describe ApplicationHelper do
end
end
context 'when @snippet is set' do
it 'returns the passed path' do
snippet = create(:snippet)
assign(:snippet, snippet)
expect(helper.external_storage_url_or_path('/foo/bar', project)).to eq('/foo/bar')
end
end
context 'when external storage is enabled' do
let(:user) { create(:user, static_object_token: 'hunter1') }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment