mirror of https://github.com/getmango/Mango.git
Add `send_attachment` function for direct download
This commit is contained in:
parent
27c111d273
commit
60100c51fe
|
@ -35,6 +35,12 @@ def send_json(env, json)
|
|||
env.response.print json
|
||||
end
|
||||
|
||||
def send_attachment(env, path)
|
||||
MIME.register ".cbz", "application/vnd.comicbook+zip"
|
||||
MIME.register ".cbr", "application/vnd.comicbook-rar"
|
||||
send_file env, path, filename: File.basename(path), disposition: "attachment"
|
||||
end
|
||||
|
||||
def hash_to_query(hash)
|
||||
hash.map { |k, v| "#{k}=#{v}" }.join("&")
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue