Commit 02b5ff07 authored by Kerri Miller's avatar Kerri Miller

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
......@@ -11,9 +11,11 @@ module Gitlab
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
......
......@@ -54,7 +54,7 @@ RSpec.describe Gitlab::Highlight do
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
......
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