Skip to content

Commit cd8fc5c

Browse files
committed
Stopped redirection for text, html files
1 parent 6f1b873 commit cd8fc5c

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

master/app/controllers/home_controller.rb

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,22 @@ def gstore
6868
end
6969
@files = @files[start..last]
7070
@fgcz = SushiFabric::Application.config.fgcz?
71+
7172
if @fgcz and !@files
72-
redirect_to "https://fgcz-gstore.uzh.ch/projects/#{@path}.#{params[:format]}"
73+
file_ext = params[:format]
74+
file_path = "#{@path}.#{file_ext}"
75+
file_full_path = File.join(SushiFabric::GSTORE_DIR, file_path)
76+
77+
case file_ext
78+
when /gz$|bam$/
79+
redirect_to "https://fgcz-gstore.uzh.ch/projects/#{file_path}"
80+
when /html$/
81+
send_file file_full_path, disposition: 'inline', type: 'text/html'
82+
when /log$|tsv$|txt$|sh$/
83+
send_file file_full_path, disposition: 'inline', type: 'text/plain'
84+
else
85+
send_file file_full_path, disposition: 'inline'
86+
end
7387
end
7488
end
7589
end

0 commit comments

Comments
 (0)