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"] |         image = env.params.url["image"] | ||||||
|         file_path = File.expand_path("libs/kemal/images/#{image}", Dir.current) |         file_path = File.expand_path("libs/kemal/images/#{image}", Dir.current) | ||||||
|         if File.exists? file_path |         if File.exists? file_path | ||||||
|           env.response.headers.add "Content-Type", "application/octet-stream" |           send_file env, file_path | ||||||
|           env.response.content_length = File.size(file_path) |  | ||||||
|           File.open(file_path) do |file| |  | ||||||
|             IO.copy(file, env.response) |  | ||||||
|           end |  | ||||||
|         end |         end | ||||||
|       end |       end | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue