Commit 393ef373 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'fix/skip-snippet-raw-buttons-for-external-caching' into 'master'

Exclude snippets from external caching handling

Closes #193498

See merge request gitlab-org/gitlab!22397
parents bfcd9d9f 1de26447
......@@ -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