2012-09-17 13:49:57 -04:00
|
|
|
# Controller for viewing a file's blame
|
2012-09-27 14:59:42 -04:00
|
|
|
class BlobController < ProjectResourceController
|
2012-09-20 13:55:14 -04:00
|
|
|
include ExtractsPath
|
2012-09-17 13:49:57 -04:00
|
|
|
|
|
|
|
# Authorize
|
|
|
|
before_filter :authorize_read_project!
|
|
|
|
before_filter :authorize_code_access!
|
|
|
|
before_filter :require_non_empty_project
|
|
|
|
|
2012-09-17 14:24:31 -04:00
|
|
|
before_filter :assign_ref_vars
|
2012-09-17 13:49:57 -04:00
|
|
|
|
|
|
|
def show
|
|
|
|
if @tree.is_blob?
|
|
|
|
send_data(
|
|
|
|
@tree.data,
|
2012-11-09 12:06:20 -05:00
|
|
|
type: @tree.mime_type,
|
2012-09-17 13:49:57 -04:00
|
|
|
disposition: 'inline',
|
|
|
|
filename: @tree.name
|
|
|
|
)
|
|
|
|
else
|
|
|
|
not_found!
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|