Cross Reference: repositories_controller.rb
xref
: /
ontohub
/
app
/
controllers
/
repositories_controller.rb
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
repositories_controller.rb revision 3b8a02784c7522e0f892ae1e2d816a7e36b9f6f2
class
RepositoriesController
<
ApplicationController
inherit_resources
defaults
finder
: :
find_by_path
!
load_and_authorize_resource
:
except
=> [:
index
, :
show
]
def
files
@
path
=
params
[:
path
]
@
info
= @
repository.path
_info
params
[:
path
]
raise
Repository
::
FileNotFoundError
, @
path
if
@
info.nil
?
if
@
info
[:
type
] == :
raw
render
text
: @
repository.read
_file
(@
path
,
params
[:
oid
])
,
content_type
:
Mime
::
Type.lookup
(
'
application
/
force-download
'
)
end
if
@
info
[:
type
] == :
file_base
@
content
= @
repository.read
_file
(@
info
[:
entry
][:
path
],
params
[:
oid
])
end
end
end