BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
c6b2a22f
Commit
c6b2a22f
authored
Apr 26, 2017
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Explain BlobViewer::Base#render_error
parent
787866a9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
0 deletions
+16
-0
base.rb
app/models/blob_viewer/base.rb
+15
-0
download.rb
app/models/blob_viewer/download.rb
+1
-0
No files found.
app/models/blob_viewer/base.rb
View file @
c6b2a22f
...
...
@@ -55,8 +55,23 @@ module BlobViewer
too_large?
&&
!
absolutely_too_large?
end
# This method is used on the server side to check whether we can attempt to
# render the blob at all. Human-readible error messages are found in the
# `BlobHelper#blob_render_error_reason` helper.
#
# This method does not and should not load the entire blob contents into
# memory, and should not be overridden to do so in order to validate the
# format of the blob.
#
# Prefer to implement a client-side viewer, where the JS component loads the
# binary from `blob_raw_url` and does its own format validation and error
# rendering, especially for potentially large binary formats.
def
render_error
if
server_side_but_stored_in_lfs?
# Files stored in LFS 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.
:server_side_but_stored_in_lfs
elsif
override_max_size
?
absolutely_too_large?
:
too_large?
:too_large
...
...
app/models/blob_viewer/download.rb
View file @
c6b2a22f
...
...
@@ -9,6 +9,7 @@ module BlobViewer
self
.
partial_name
=
'download'
self
.
binary
=
true
# We can always render the Download viewer, even if the blob is in LFS or too large.
def
render_error
nil
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment