From 3d2d30db937d0b548829d535cbdd8918992c1ee9 Mon Sep 17 00:00:00 2001 From: Samantaz Fox Date: Sun, 20 Feb 2022 22:27:02 +0100 Subject: [PATCH 01/16] Ignore HTTP::Server::Response patching for crystal >= 1.3.0 Closes #627 --- src/kemal/ext/response.cr | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/kemal/ext/response.cr b/src/kemal/ext/response.cr index 6fd4c01..103046f 100644 --- a/src/kemal/ext/response.cr +++ b/src/kemal/ext/response.cr @@ -1,3 +1,7 @@ +# This override collides with the new stdlib of Crystal 1.3 +# See https://github.com/kemalcr/kemal/issues/627 for more details +{{ skip_file if compare_versions(Crystal::VERSION, "1.3.0") >= 0 }} + class HTTP::Server::Response class Output def close From 59720fbd1631c9d567d74918975b3aaccbb031b7 Mon Sep 17 00:00:00 2001 From: Serdar Dogruyol <990485+sdogruyol@users.noreply.github.com> Date: Tue, 22 Feb 2022 17:29:53 +0300 Subject: [PATCH 02/16] Bump version to 1.1.1 --- CHANGELOG.md | 3 +++ shard.yml | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b0f83c..0a2fe4b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# 1.1.1 (22-02-2022) + +- Ignore HTTP::Server::Response patching for crystal >= 1.3.0 [#628](https://github.com/kemalcr/kemal/pull/628). Thanks @SamantazFox :pray: # 1.1.0 (02-09-2021) - You can now set your own application name for startup message [#606](https://github.com/kemalcr/kemal/pull/606). Thanks @aravindavk :pray: diff --git a/shard.yml b/shard.yml index 72011fd..b5e7b15 100644 --- a/shard.yml +++ b/shard.yml @@ -1,5 +1,5 @@ name: kemal -version: 1.1.0 +version: 1.1.1 authors: - Serdar Dogruyol From d6dc893052ff0ba92809d3488b0bd3fa3456d139 Mon Sep 17 00:00:00 2001 From: matthewmcgarvey Date: Wed, 23 Feb 2022 17:36:28 -0600 Subject: [PATCH 03/16] Fix content rendering --- spec/view_spec.cr | 12 +++++++++++- src/kemal/helpers/macros.cr | 20 ++++++++------------ 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/spec/view_spec.cr b/spec/view_spec.cr index 4705233..2a60574 100644 --- a/spec/view_spec.cr +++ b/spec/view_spec.cr @@ -22,7 +22,7 @@ describe "Views" do end request = HTTP::Request.new("GET", "/view/world") client_response = call_request_on_app(request) - client_response.body.should contain("Hello world") + client_response.body.strip.should eq("Hello world\n") end it "renders layout" do @@ -59,4 +59,14 @@ describe "Views" do client_response.body.should contain("Hello world") client_response.body.should contain("

Hello from otherside

") end + + it "does not render content_for that was not yielded" do + get "/view/:name" do |env| + name = env.params.url["name"] + render "#{__DIR__}/asset/hello_with_content_for.ecr", "#{__DIR__}/asset/layout.ecr" + end + request = HTTP::Request.new("GET", "/view/world") + client_response = call_request_on_app(request) + client_response.body.should_not contain("

Hello from otherside

") + end end diff --git a/src/kemal/helpers/macros.cr b/src/kemal/helpers/macros.cr index 41c8793..84982ff 100644 --- a/src/kemal/helpers/macros.cr +++ b/src/kemal/helpers/macros.cr @@ -1,4 +1,4 @@ -CONTENT_FOR_BLOCKS = Hash(String, Tuple(String, Proc(String))).new +CONTENT_FOR_BLOCKS = Hash(String, Tuple(String, Proc(Nil))).new # `content_for` is a set of helpers that allows you to capture # blocks inside views to be rendered later during the request. The most @@ -34,13 +34,7 @@ CONTENT_FOR_BLOCKS = Hash(String, Tuple(String, Proc(String))).new # layout, inside the tag, and each view can call `content_for` # setting the appropriate set of tags that should be added to the layout. macro content_for(key, file = __FILE__) - %proc = ->() { - __view_io__ = IO::Memory.new - {{ yield }} - __view_io__.to_s - } - - CONTENT_FOR_BLOCKS[{{key}}] = Tuple.new {{file}}, %proc + CONTENT_FOR_BLOCKS[{{key}}] = Tuple.new {{file}}, ->() { {{ yield }} } nil end @@ -60,10 +54,12 @@ end # ``` macro render(filename, layout) __content_filename__ = {{filename}} - io = IO::Memory.new - content = ECR.embed {{filename}}, io - ECR.embed {{layout}}, io - io.to_s + content_io = IO::Memory.new + ECR.embed {{filename}}, content_io + content = content_io.to_s + layout_io = IO::Memory.new + ECR.embed {{layout}}, layout_io + layout_io.to_s end # Render view with the given filename. From 1d54971efa41089a6821ee14bb14357af5cfb503 Mon Sep 17 00:00:00 2001 From: Serdar Dogruyol <990485+sdogruyol@users.noreply.github.com> Date: Thu, 24 Feb 2022 17:56:54 +0300 Subject: [PATCH 04/16] Bump version to 1.1.2 --- CHANGELOG.md | 4 ++++ shard.yml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a2fe4b..0374757 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 1.1.2 (24-02-2022) + +- Fix content rendering [#631](https://github.com/kemalcr/kemal/pull/631). Thanks @matthewmcgarvey :pray: + # 1.1.1 (22-02-2022) - Ignore HTTP::Server::Response patching for crystal >= 1.3.0 [#628](https://github.com/kemalcr/kemal/pull/628). Thanks @SamantazFox :pray: diff --git a/shard.yml b/shard.yml index b5e7b15..e21ca85 100644 --- a/shard.yml +++ b/shard.yml @@ -1,5 +1,5 @@ name: kemal -version: 1.1.1 +version: 1.1.2 authors: - Serdar Dogruyol From f706c7877d3c2e20cfa5ce6c10ee72011dd7ff6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20M=C3=BCller?= Date: Sat, 28 May 2022 14:30:19 +0200 Subject: [PATCH 05/16] Update ameba to 1.0 --- shard.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shard.yml b/shard.yml index e21ca85..333d577 100644 --- a/shard.yml +++ b/shard.yml @@ -15,7 +15,7 @@ dependencies: development_dependencies: ameba: github: crystal-ameba/ameba - version: ~> 0.14.0 + version: ~> 1.0 crystal: ">= 0.36.0" From d53d2536202cd57e8e1fc64d67ba31741562b07e Mon Sep 17 00:00:00 2001 From: Alexander Zhou Date: Fri, 27 May 2022 11:49:42 +0800 Subject: [PATCH 06/16] Eliminated several seconds of delay when loading big mp4 file --- src/kemal/helpers/helpers.cr | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/src/kemal/helpers/helpers.cr b/src/kemal/helpers/helpers.cr index bf212a2..11a6b62 100644 --- a/src/kemal/helpers/helpers.cr +++ b/src/kemal/helpers/helpers.cr @@ -216,20 +216,7 @@ private def multipart(file, env : HTTP::Server::Context) env.response.headers["Accept-Ranges"] = "bytes" env.response.headers["Content-Range"] = "bytes #{startb}-#{endb}/#{fileb}" # MUST - if startb > 1024 - skipped = 0_i64 - # file.skip only accepts values less or equal to 1024 (buffer size, undocumented) - until (increase_skipped = skipped + 1024_i64) > startb - file.skip(1024) - skipped = increase_skipped - end - if (skipped_minus_startb = skipped - startb) > 0 - file.skip skipped_minus_startb - end - else - file.skip(startb) - end - + file.seek(startb) IO.copy(file, env.response, content_length) else env.response.content_length = fileb From 317d086b4c83c8677692db9799134799a22bcf31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Serdar=20Dogruyol=20-=20Sedo=20=E3=82=BB=E3=83=89?= <990485+sdogruyol@users.noreply.github.com> Date: Mon, 27 Jun 2022 12:28:13 +0300 Subject: [PATCH 07/16] fix content_for failing to capture the correct block input (#639) --- spec/asset/hello_with_content_for.ecr | 4 ++-- spec/asset/layout_with_yield.ecr | 4 +++- spec/asset/layout_with_yield_and_vars.ecr | 8 +++++--- spec/view_spec.cr | 4 ++-- src/kemal/helpers/macros.cr | 9 ++++++++- 5 files changed, 20 insertions(+), 9 deletions(-) diff --git a/spec/asset/hello_with_content_for.ecr b/spec/asset/hello_with_content_for.ecr index 149b294..b5460f9 100644 --- a/spec/asset/hello_with_content_for.ecr +++ b/spec/asset/hello_with_content_for.ecr @@ -1,5 +1,5 @@ Hello <%= name %> -<% content_for "custom" do %> -

Hello from otherside

+<% content_for "meta" do %> +Kemal Spec <% end %> \ No newline at end of file diff --git a/spec/asset/layout_with_yield.ecr b/spec/asset/layout_with_yield.ecr index f6cd673..3710c4a 100644 --- a/spec/asset/layout_with_yield.ecr +++ b/spec/asset/layout_with_yield.ecr @@ -1,6 +1,8 @@ + + <%= yield_content "meta" %> + <%= content %> - <%= yield_content "custom" %> \ No newline at end of file diff --git a/spec/asset/layout_with_yield_and_vars.ecr b/spec/asset/layout_with_yield_and_vars.ecr index 3a82a7a..d2a8a35 100644 --- a/spec/asset/layout_with_yield_and_vars.ecr +++ b/spec/asset/layout_with_yield_and_vars.ecr @@ -1,8 +1,10 @@ + + <%= yield_content "meta" %> + <%= content %> - <%= yield_content "custom" %> - <%= var1 %> - <%= var2 %> + <%= var1 %> + <%= var2 %> \ No newline at end of file diff --git a/spec/view_spec.cr b/spec/view_spec.cr index 2a60574..79b8768 100644 --- a/spec/view_spec.cr +++ b/spec/view_spec.cr @@ -56,8 +56,8 @@ describe "Views" do end request = HTTP::Request.new("GET", "/view/world") client_response = call_request_on_app(request) - client_response.body.should contain("Hello world") - client_response.body.should contain("

Hello from otherside

") + client_response.body.scan("Hello world").size.should eq(1) + client_response.body.should contain("Kemal Spec") end it "does not render content_for that was not yielded" do diff --git a/src/kemal/helpers/macros.cr b/src/kemal/helpers/macros.cr index 84982ff..71ba2be 100644 --- a/src/kemal/helpers/macros.cr +++ b/src/kemal/helpers/macros.cr @@ -43,7 +43,14 @@ macro yield_content(key) if CONTENT_FOR_BLOCKS.has_key?({{key}}) __caller_filename__ = CONTENT_FOR_BLOCKS[{{key}}][0] %proc = CONTENT_FOR_BLOCKS[{{key}}][1] - %proc.call if __content_filename__ == __caller_filename__ + + if __content_filename__ == __caller_filename__ + %old_content_io, content_io = content_io, IO::Memory.new + %proc.call + %result = content_io.to_s + content_io = %old_content_io + %result + end end end From 9bd24caf7e20bc7c1274daa6d94f29074fe25588 Mon Sep 17 00:00:00 2001 From: Chao Yang Date: Wed, 29 Jun 2022 05:25:40 -0500 Subject: [PATCH 08/16] Closes response by default in HTTP::Server::Context#redirect (#641) --- spec/route_handler_spec.cr | 36 ++++++++++++++++++++++++++++++++++++ src/kemal/ext/context.cr | 3 ++- 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/spec/route_handler_spec.cr b/spec/route_handler_spec.cr index 93cf0f0..81d447f 100644 --- a/spec/route_handler_spec.cr +++ b/spec/route_handler_spec.cr @@ -143,4 +143,40 @@ describe "Kemal::RouteHandler" do client_response.body.should eq("Redirecting to /login") client_response.headers.has_key?("Location").should eq(true) end + + it "redirects and closes response in before filter" do + filter_handler = Kemal::FilterHandler.new + filter_handler._add_route_filter("GET", "/", :before) do |env| + env.redirect "/login" + end + Kemal.config.add_filter_handler(filter_handler) + + get "/" do |env| + "home page" + end + + request = HTTP::Request.new("GET", "/") + client_response = call_request_on_app(request) + client_response.status_code.should eq(302) + client_response.body.should eq("") + client_response.headers.has_key?("Location").should eq(true) + end + + it "redirects in before filter without closing response" do + filter_handler = Kemal::FilterHandler.new + filter_handler._add_route_filter("GET", "/", :before) do |env| + env.redirect "/login", close: false + end + Kemal.config.add_filter_handler(filter_handler) + + get "/" do |env| + "home page" + end + + request = HTTP::Request.new("GET", "/") + client_response = call_request_on_app(request) + client_response.status_code.should eq(302) + client_response.body.should eq("home page") + client_response.headers.has_key?("Location").should eq(true) + end end diff --git a/src/kemal/ext/context.cr b/src/kemal/ext/context.cr index c2e51c6..70787b6 100644 --- a/src/kemal/ext/context.cr +++ b/src/kemal/ext/context.cr @@ -17,10 +17,11 @@ class HTTP::Server @params ||= Kemal::ParamParser.new(@request, route_lookup.params) end - def redirect(url : String, status_code : Int32 = 302, *, body : String? = nil) + def redirect(url : String, status_code : Int32 = 302, *, body : String? = nil, close : Bool = true) @response.headers.add "Location", url @response.status_code = status_code @response.print(body) if body + @response.close if close end def route From f8fc8ce8c8d75625d5ff75dc16c913aaf564b07b Mon Sep 17 00:00:00 2001 From: Serdar Dogruyol <990485+sdogruyol@users.noreply.github.com> Date: Wed, 29 Jun 2022 13:29:50 +0300 Subject: [PATCH 09/16] fix ameba warnings --- spec/route_handler_spec.cr | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/route_handler_spec.cr b/spec/route_handler_spec.cr index 81d447f..e3046e3 100644 --- a/spec/route_handler_spec.cr +++ b/spec/route_handler_spec.cr @@ -151,7 +151,7 @@ describe "Kemal::RouteHandler" do end Kemal.config.add_filter_handler(filter_handler) - get "/" do |env| + get "/" do "home page" end @@ -169,7 +169,7 @@ describe "Kemal::RouteHandler" do end Kemal.config.add_filter_handler(filter_handler) - get "/" do |env| + get "/" do "home page" end From 268e501a633afbdc62fcfa8820d632cafa5cbed0 Mon Sep 17 00:00:00 2001 From: Serdar Dogruyol <990485+sdogruyol@users.noreply.github.com> Date: Wed, 29 Jun 2022 13:31:28 +0300 Subject: [PATCH 10/16] fix Crystal 1.5.0 warnings --- spec/spec_helper.cr | 4 ++-- src/kemal/handler.cr | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/spec_helper.cr b/spec/spec_helper.cr index 803aacf..0065848 100644 --- a/spec/spec_helper.cr +++ b/spec/spec_helper.cr @@ -4,8 +4,8 @@ require "../src/*" include Kemal class CustomLogHandler < Kemal::BaseLogHandler - def call(env) - call_next env + def call(context) + call_next(context) end def write(message) diff --git a/src/kemal/handler.cr b/src/kemal/handler.cr index bb59238..6016ba7 100644 --- a/src/kemal/handler.cr +++ b/src/kemal/handler.cr @@ -27,8 +27,8 @@ module Kemal end end - def call(env : HTTP::Server::Context) - call_next(env) + def call(context : HTTP::Server::Context) + call_next(context) end # Processes the path based on `only` paths which is a `Array(String)`. From 05d55540b9cbcab9e9197390e2f6b2d0baeed820 Mon Sep 17 00:00:00 2001 From: Russell Smith Date: Thu, 30 Jun 2022 08:00:51 -0700 Subject: [PATCH 11/16] Enable option for index.html to be a directories default (#640) --- spec/static_file_handler_spec.cr | 9 +++++++++ src/kemal/config.cr | 2 +- src/kemal/static_file_handler.cr | 17 ++++++++++++++--- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/spec/static_file_handler_spec.cr b/spec/static_file_handler_spec.cr index e9307f6..309e10f 100644 --- a/spec/static_file_handler_spec.cr +++ b/spec/static_file_handler_spec.cr @@ -23,6 +23,15 @@ describe Kemal::StaticFileHandler do response.body.should eq(File.read("#{__DIR__}/static/dir/test.txt")) end + it "should serve the 'index.html' file when a directory is requested and index serving is enabled" do + serve_static({"dir_index" => true}) + response = handle HTTP::Request.new("GET", "/dir/") + response.status_code.should eq(200) + response.headers["Content-Type"].should eq "text/html" + response.headers["Etag"].should contain "W/\"" + response.body.should eq(File.read("#{__DIR__}/static/dir/index.html")) + end + it "should respond with 304 if file has not changed" do response = handle HTTP::Request.new("GET", "/dir/test.txt") response.status_code.should eq(200) diff --git a/src/kemal/config.cr b/src/kemal/config.cr index 4e62d8d..23372dd 100644 --- a/src/kemal/config.cr +++ b/src/kemal/config.cr @@ -31,7 +31,7 @@ module Kemal @host_binding = "0.0.0.0" @port = 3000 @env = ENV["KEMAL_ENV"]? || "development" - @serve_static = {"dir_listing" => false, "gzip" => true} + @serve_static = {"dir_listing" => false, "gzip" => true, "dir_index" => false} @public_folder = "./public" @logging = true @logger = nil diff --git a/src/kemal/static_file_handler.cr b/src/kemal/static_file_handler.cr index 109e971..ef592d0 100644 --- a/src/kemal/static_file_handler.cr +++ b/src/kemal/static_file_handler.cr @@ -36,7 +36,7 @@ module Kemal end file_path = File.join(@public_dir, expanded_path) - is_dir = Dir.exists? file_path + is_dir = Dir.exists?(file_path) if request_path != expanded_path redirect_to context, expanded_path @@ -44,8 +44,19 @@ module Kemal redirect_to context, expanded_path + '/' end - if Dir.exists?(file_path) - if config.is_a?(Hash) && config["dir_listing"] == true + if is_dir + if config.is_a?(Hash) && config.fetch("dir_index", false) && File.exists?(File.join(file_path, "index.html")) + file_path = File.join(@public_dir, expanded_path, "index.html") + + last_modified = modification_time(file_path) + add_cache_headers(context.response.headers, last_modified) + + if cache_request?(context, last_modified) + context.response.status_code = 304 + return + end + send_file(context, file_path) + elsif config.is_a?(Hash) && config.fetch("dir_listing", false) context.response.content_type = "text/html" directory_listing(context.response, request_path, file_path) else From 1a45f54c6c42159d266e278545c2969dc79f5243 Mon Sep 17 00:00:00 2001 From: Oleksii Vasyliev Date: Sat, 16 Jul 2022 12:44:40 +0300 Subject: [PATCH 12/16] Disable signal trap for usage kemal with other tools (#642) --- src/kemal.cr | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/kemal.cr b/src/kemal.cr index 6f1a564..9222fe6 100644 --- a/src/kemal.cr +++ b/src/kemal.cr @@ -7,18 +7,18 @@ require "./kemal/helpers/*" module Kemal # Overload of `self.run` with the default startup logging. - def self.run(port : Int32?, args = ARGV) - self.run(port, args) { } + def self.run(port : Int32?, args = ARGV, trap_signal : Bool = true) + self.run(port, args, trap_signal) { } end # Overload of `self.run` without port. - def self.run(args = ARGV) - self.run(nil, args: args) + def self.run(args = ARGV, trap_signal : Bool = true) + self.run(nil, args: args, trap_signal: trap_signal) end # Overload of `self.run` to allow just a block. def self.run(args = ARGV, &block) - self.run(nil, args: args, &block) + self.run(nil, args: args, trap_signal: true, &block) end # The command to run a `Kemal` application. @@ -27,7 +27,7 @@ module Kemal # # To use custom command line arguments, set args to nil # - def self.run(port : Int32? = nil, args = ARGV, &block) + def self.run(port : Int32? = nil, args = ARGV, trap_signal : Bool = true, &block) Kemal::CLI.new args config = Kemal.config config.setup @@ -36,7 +36,7 @@ module Kemal # Test environment doesn't need to have signal trap and logging. if config.env != "test" setup_404 - setup_trap_signal + setup_trap_signal if trap_signal end server = config.server ||= HTTP::Server.new(config.handlers) From c993a05731363929aacdde9fd8ccc97a6d15b967 Mon Sep 17 00:00:00 2001 From: Serdar Dogruyol <990485+sdogruyol@users.noreply.github.com> Date: Thu, 7 Jul 2022 12:00:45 +0300 Subject: [PATCH 13/16] Add changelog for 1.2.0 --- CHANGELOG.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0374757..3bc639b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,17 @@ +# 1.2.0 (07-07-2022) + +- Crystal 1.5.0 support :tada: +- Eliminated several seconds of delay when loading big mp4 file. Thanks @Athlon64 :pray: +- Fix content_for failing to capture the correct block input [#639](https://github.com/kemalcr/kemal/pull/639). Thanks @sdogruyol :pray: +- Closes response by default in HTTP::Server::Context#redirect [#641](https://github.com/kemalcr/kemal/pull/641). Thanks @cyangle :pray: +- Enable option for index.html to be a directories default [#640](https://github.com/kemalcr/kemal/pull/640). Thanks @ukd1 :pray: + +You can enable it via + +```crystal + serve_static({"dir_index" => true}) +``` + # 1.1.2 (24-02-2022) - Fix content rendering [#631](https://github.com/kemalcr/kemal/pull/631). Thanks @matthewmcgarvey :pray: From 707e61641cddeb662a561a6db2d35025f56bcf25 Mon Sep 17 00:00:00 2001 From: Serdar Dogruyol <990485+sdogruyol@users.noreply.github.com> Date: Thu, 7 Jul 2022 12:02:34 +0300 Subject: [PATCH 14/16] Bump version to 1.2.0 --- shard.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shard.yml b/shard.yml index 333d577..69a311a 100644 --- a/shard.yml +++ b/shard.yml @@ -1,5 +1,5 @@ name: kemal -version: 1.1.2 +version: 1.2.0 authors: - Serdar Dogruyol From 4aa28c423c6b1d7b8419f42b9c4cb12267b81066 Mon Sep 17 00:00:00 2001 From: Serdar Dogruyol <990485+sdogruyol@users.noreply.github.com> Date: Sat, 30 Jul 2022 11:18:46 +0300 Subject: [PATCH 15/16] Enable GH sponsors --- .github/FUNDING.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 3452e4a..f52233b 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,6 +1,6 @@ # These are supported funding model platforms -github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] +github: sdogruyol patreon: sdogruyol open_collective: # Replace with a single Open Collective username ko_fi: # Replace with a single Ko-fi username From f5d767fe7e02baed9e828ab750ef6809ba94652d Mon Sep 17 00:00:00 2001 From: Anton Maminov Date: Thu, 4 Aug 2022 12:42:18 +0300 Subject: [PATCH 16/16] Fix static file handler for Crystal 1.6.0 (#644) --- src/kemal/static_file_handler.cr | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/kemal/static_file_handler.cr b/src/kemal/static_file_handler.cr index ef592d0..dbeca28 100644 --- a/src/kemal/static_file_handler.cr +++ b/src/kemal/static_file_handler.cr @@ -75,5 +75,9 @@ module Kemal call_next(context) end end + + private def modification_time(file_path) + File.info(file_path).modification_time + end end end