blob: 05a3dd7d913249c5bb599553b8ea7d296b536a19 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
module BlobViewer
module ServerSide
extend ActiveSupport::Concern
included do
self.load_async = true
self.collapse_limit = 2.megabytes
self.size_limit = 5.megabytes
end
def prepare!
if blob.project
blob.load_all_data!(blob.project.repository)
end
end
def render_error
if blob.stored_externally?
# Files that are not stored in the repository, like LFS files and
# build artifacts, can only be rendered using a client-side viewer,
# since we do not want to read large amounts of data into memory on the
# server side. Client-side viewers use JS and can fetch the file from
# `blob_raw_url` using AJAX.
return :server_side_but_stored_externally
end
super
end
end
end
|