From 24424d932f10c1a498a77d742d5ffd6ae18c506d Mon Sep 17 00:00:00 2001 From: Sean McGivern Date: Fri, 26 Aug 2016 10:54:19 +0100 Subject: [PATCH] Fix merge conflict size limit --- CHANGELOG | 1 + lib/gitlab/conflict/parser.rb | 2 +- spec/lib/gitlab/conflict/parser_spec.rb | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index bf1136afd03..fbb304b677d 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -97,6 +97,7 @@ v 8.12.0 (unreleased) v 8.11.5 (unreleased) - Optimize branch lookups and force a repository reload for Repository#find_branch - Fix member expiration date picker after update + - Make merge conflict file size limit 200 KB, to match the docs - Fix suggested colors options for new labels in the admin area. !6138 - Fix GitLab import button - Remove gitorious from import_sources diff --git a/lib/gitlab/conflict/parser.rb b/lib/gitlab/conflict/parser.rb index 2d4d55daeeb..98e842cded3 100644 --- a/lib/gitlab/conflict/parser.rb +++ b/lib/gitlab/conflict/parser.rb @@ -18,7 +18,7 @@ module Gitlab def parse(text, our_path:, their_path:, parent_file: nil) raise UnmergeableFile if text.blank? # Typically a binary file - raise UnmergeableFile if text.length > 102400 + raise UnmergeableFile if text.length > 200.kilobytes begin text.to_json diff --git a/spec/lib/gitlab/conflict/parser_spec.rb b/spec/lib/gitlab/conflict/parser_spec.rb index a1d2ca1e272..16eb3766356 100644 --- a/spec/lib/gitlab/conflict/parser_spec.rb +++ b/spec/lib/gitlab/conflict/parser_spec.rb @@ -179,8 +179,8 @@ CONFLICT to raise_error(Gitlab::Conflict::Parser::UnmergeableFile) end - it 'raises UnmergeableFile when the file is over 100 KB' do - expect { parse_text('a' * 102401) }. + it 'raises UnmergeableFile when the file is over 200 KB' do + expect { parse_text('a' * 204801) }. to raise_error(Gitlab::Conflict::Parser::UnmergeableFile) end