Skip to content

Commit

Permalink
Fix unexpected static routing
Browse files Browse the repository at this point in the history
  • Loading branch information
yanecc committed May 11, 2024
1 parent d27ffa5 commit bf23ab5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/grip/handlers/static.cr
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ module Grip
is_dir_path = dir_path? original_path
expanded_path = Path.posix(request_path).expand("/").to_s
expanded_path += "/" if is_dir_path && !dir_path?(expanded_path)
relative_path = request_path.lchop(routing)
relative_path = request_path.lchop?(routing) || begin
call_next(context)
expanded_path
end

is_dir_path = dir_path? expanded_path
file_path = File.join(@public_dir, Path[relative_path])
Expand Down

0 comments on commit bf23ab5

Please sign in to comment.