Skip to content
Snippets Groups Projects
Commit 02b5ff07 authored by Kerri Miller's avatar Kerri Miller
Browse files

Merge branch '330894-determine-the-right-file-size-limit-for-highlighting-files' into 'master'

Add a better label to `over_highlight_size_limit`

See merge request gitlab-org/gitlab!62241
parents c3175cb4 5305be64
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -11,9 +11,11 @@ def self.highlight(blob_name, blob_content, language: nil, plain: false)
end
 
def self.too_large?(size)
return false unless size.to_i > Gitlab.config.extra['maximum_text_highlight_size_kilobytes']
file_size_limit = Gitlab.config.extra['maximum_text_highlight_size_kilobytes']
 
over_highlight_size_limit.increment(source: "text highlighter") if Feature.enabled?(:track_file_size_over_highlight_limit)
return false unless size.to_i > file_size_limit
over_highlight_size_limit.increment(source: "file size: #{file_size_limit}") if Feature.enabled?(:track_file_size_over_highlight_limit)
 
true
end
Loading
Loading
Loading
Loading
@@ -54,7 +54,7 @@ def test(input):
end
 
it 'increments the metric for oversized files' do
expect { result }.to change { over_highlight_size_limit('text highlighter') }.by(1)
expect { result }.to change { over_highlight_size_limit('file size: 0.0001') }.by(1)
end
 
it 'returns plain version for long content' do
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment