Use consistent headers method and/or variable
This commit is contained in:
@@ -14,7 +14,7 @@ module Calligraphy
|
|||||||
xml = xml_for body: body, node: 'lockinfo'
|
xml = xml_for body: body, node: 'lockinfo'
|
||||||
return :bad_request if xml == :bad_request
|
return :bad_request if xml == :bad_request
|
||||||
|
|
||||||
lock_properties = @resource.lock xml, headers['Depth']
|
lock_properties = @resource.lock xml, @headers['Depth']
|
||||||
end
|
end
|
||||||
|
|
||||||
builder = xml_builder
|
builder = xml_builder
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
module Calligraphy
|
module Calligraphy
|
||||||
class Put < WebDavRequest
|
class Put < WebDavRequest
|
||||||
def request
|
def request
|
||||||
return :locked if @resource.locked_to_user? headers
|
return :locked if @resource.locked_to_user? @headers
|
||||||
return :method_not_allowed if @resource.collection?
|
return :method_not_allowed if @resource.collection?
|
||||||
|
|
||||||
@resource.write
|
@resource.write
|
||||||
|
|||||||
@@ -39,12 +39,8 @@ module Calligraphy::Rails
|
|||||||
@resource = @resource_class.new resource: resource_id, req: request, root_dir: @resource_root_path
|
@resource = @resource_class.new resource: resource_id, req: request, root_dir: @resource_root_path
|
||||||
end
|
end
|
||||||
|
|
||||||
def headers
|
|
||||||
request.headers
|
|
||||||
end
|
|
||||||
|
|
||||||
def check_preconditions
|
def check_preconditions
|
||||||
return true unless headers['If'].present?
|
return true unless request.headers['If'].present?
|
||||||
|
|
||||||
evaluate_if_header
|
evaluate_if_header
|
||||||
end
|
end
|
||||||
@@ -64,10 +60,10 @@ module Calligraphy::Rails
|
|||||||
end
|
end
|
||||||
|
|
||||||
def get_if_conditions
|
def get_if_conditions
|
||||||
lists = if headers['If'][0] == '<'
|
lists = if request.headers['If'][0] == '<'
|
||||||
headers['If'].split Calligraphy::TAGGED_LIST_REGEX
|
request.headers['If'].split Calligraphy::TAGGED_LIST_REGEX
|
||||||
else
|
else
|
||||||
headers['If'].split Calligraphy::UNTAGGAGED_LIST_REGEX
|
request.headers['If'].split Calligraphy::UNTAGGAGED_LIST_REGEX
|
||||||
end
|
end
|
||||||
|
|
||||||
lists
|
lists
|
||||||
@@ -110,7 +106,7 @@ module Calligraphy::Rails
|
|||||||
if target.locked?
|
if target.locked?
|
||||||
conditions_met = false unless target.lock_tokens&.include? conditions[:lock_token]
|
conditions_met = false unless target.lock_tokens&.include? conditions[:lock_token]
|
||||||
else
|
else
|
||||||
conditions_met = false if target.locked_to_user? headers
|
conditions_met = false if target.locked_to_user? request.headers
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -129,7 +125,7 @@ module Calligraphy::Rails
|
|||||||
end
|
end
|
||||||
|
|
||||||
def web_dav_request
|
def web_dav_request
|
||||||
{ headers: headers, request: request, resource: @resource, response: response }
|
{ headers: request.headers, request: request, resource: @resource, response: response }
|
||||||
end
|
end
|
||||||
|
|
||||||
def options
|
def options
|
||||||
|
|||||||
Reference in New Issue
Block a user