Commit 1cc0d426 authored by Stan Hu's avatar Stan Hu

Merge branch 'id-fix-viewing-diff-of-a-large-blob' into 'master'

Load 10mb of a diff instead of 100kb

See merge request gitlab-org/gitlab!25176
parents 14990b7b 0ee1313d
...@@ -353,11 +353,7 @@ module Gitlab ...@@ -353,11 +353,7 @@ module Gitlab
def fetch_blob(sha, path) def fetch_blob(sha, path)
return unless sha return unless sha
# Load only patch_hard_limit_bytes number of bytes for the blob Blob.lazy(repository.project, sha, path)
# Because otherwise, it is too large to be displayed
Blob.lazy(
repository.project, sha, path,
blob_size_limit: Gitlab::Git::Diff.patch_hard_limit_bytes)
end end
def total_blob_lines(blob) def total_blob_lines(blob)
......
...@@ -175,7 +175,7 @@ describe Gitlab::Diff::File do ...@@ -175,7 +175,7 @@ describe Gitlab::Diff::File do
[diff_file.new_content_sha, diff_file.new_path], [diff_file.old_content_sha, diff_file.old_path] [diff_file.new_content_sha, diff_file.new_path], [diff_file.old_content_sha, diff_file.old_path]
] ]
expect(project.repository).to receive(:blobs_at).with(items, blob_size_limit: 100 * 1024).and_call_original expect(project.repository).to receive(:blobs_at).with(items, blob_size_limit: 10.megabytes).and_call_original
old_data = diff_file.old_blob.data old_data = diff_file.old_blob.data
data = diff_file.new_blob.data data = diff_file.new_blob.data
......
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