Fixed protected requests

This commit is contained in:
Yessiest 2023-04-15 01:52:59 +04:00
parent 98d940073b
commit c41c29a901
1 changed files with 3 additions and 2 deletions

View File

@ -58,7 +58,7 @@ module Hyde
# Request object with safe path encapsulation # Request object with safe path encapsulation
class ProtectedRequest < Request class ProtectedRequest < Request
def self.from_request(request) def initialize(request)
@path = request.path @path = request.path
@filepath = request.filepath @filepath = request.filepath
@request = request.request @request = request.request
@ -77,8 +77,9 @@ module Hyde
end end
def match(request) def match(request)
if match? request.path then if match? request.path then
p_request = Hyde::ProtectedRequest.new(request)
@lock_methods = true @lock_methods = true
self.instance_exec request, &@block if @block self.instance_exec p_request, &@block if @block
@lock_methods = false @lock_methods = false
end end
end end