mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 17:06:31 -06:00
FEATURE: allow inline disposition on uploads
when linking an upload allow ?inline=1 to display upload inline
This commit is contained in:
parent
03bc91f204
commit
4fc3834dd6
@ -34,7 +34,9 @@ class UploadsController < ApplicationController
|
|||||||
|
|
||||||
# the "url" parameter is here to prevent people from scanning the uploads using the id
|
# the "url" parameter is here to prevent people from scanning the uploads using the id
|
||||||
if upload = (Upload.find_by(id: id, url: url) || Upload.find_by(sha1: params[:sha]))
|
if upload = (Upload.find_by(id: id, url: url) || Upload.find_by(sha1: params[:sha]))
|
||||||
send_file(Discourse.store.path_for(upload), filename: upload.original_filename)
|
opts = {filename: upload.original_filename}
|
||||||
|
opts[:disposition] = 'inline' if params[:inline]
|
||||||
|
send_file(Discourse.store.path_for(upload),opts)
|
||||||
else
|
else
|
||||||
render_404
|
render_404
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user