mirror of
https://gitea.invidious.io/iv-org/shard-kemal.git
synced 2024-08-15 00:53:36 +00:00
Use send_file in built-in image handler
This commit is contained in:
parent
5e297d86f8
commit
676ed2aa67
1 changed files with 1 additions and 5 deletions
|
@ -35,11 +35,7 @@ module Kemal
|
|||
image = env.params.url["image"]
|
||||
file_path = File.expand_path("libs/kemal/images/#{image}", Dir.current)
|
||||
if File.exists? file_path
|
||||
env.response.headers.add "Content-Type", "application/octet-stream"
|
||||
env.response.content_length = File.size(file_path)
|
||||
File.open(file_path) do |file|
|
||||
IO.copy(file, env.response)
|
||||
end
|
||||
send_file env, file_path
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue