mirror of
				https://gitea.invidious.io/iv-org/shard-kemal.git
				synced 2024-08-15 00:53:36 +00:00 
			
		
		
		
	Leave tmpfile management to OS
This commit is contained in:
		
							parent
							
								
									79e324efaf
								
							
						
					
					
						commit
						a1520de7ed
					
				
					 2 changed files with 4 additions and 7 deletions
				
			
		|  | @ -7,6 +7,10 @@ class HTTP::Request | ||||||
|     @override_method ||= check_for_method_override! |     @override_method ||= check_for_method_override! | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|  |   def content_type | ||||||
|  |     @headers["Content-Type"]? | ||||||
|  |   end | ||||||
|  | 
 | ||||||
|   # Checks if method contained in _method param is valid one |   # Checks if method contained in _method param is valid one | ||||||
|   def self.override_method_valid?(override_method : String) |   def self.override_method_valid?(override_method : String) | ||||||
|     return false unless override_method.is_a?(String) |     return false unless override_method.is_a?(String) | ||||||
|  |  | ||||||
|  | @ -45,7 +45,6 @@ module Kemal | ||||||
|       route = context.route_lookup.payload.as(Route) |       route = context.route_lookup.payload.as(Route) | ||||||
|       content = route.handler.call(context) |       content = route.handler.call(context) | ||||||
|     ensure |     ensure | ||||||
|       remove_tmpfiles(context) |  | ||||||
|       if Kemal.config.error_handlers.has_key?(context.response.status_code) |       if Kemal.config.error_handlers.has_key?(context.response.status_code) | ||||||
|         raise Kemal::Exceptions::CustomException.new(context) |         raise Kemal::Exceptions::CustomException.new(context) | ||||||
|       end |       end | ||||||
|  | @ -53,12 +52,6 @@ module Kemal | ||||||
|       context |       context | ||||||
|     end |     end | ||||||
| 
 | 
 | ||||||
|     private def remove_tmpfiles(context) |  | ||||||
|       context.params.files.each do |field, file| |  | ||||||
|         File.delete(file.tmpfile.path) if ::File.exists?(file.tmpfile.path) |  | ||||||
|       end |  | ||||||
|     end |  | ||||||
| 
 |  | ||||||
|     private def radix_path(method, path) |     private def radix_path(method, path) | ||||||
|       "/#{method.downcase}#{path}" |       "/#{method.downcase}#{path}" | ||||||
|     end |     end | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue