Move the Content-Type format validation with the other validations
This commit is contained in:
parent
71d138894e
commit
c2d5fc9e07
@ -118,6 +118,9 @@ module RemoteStorage
|
||||
end
|
||||
|
||||
def put_data(user, directory, key, data, content_type)
|
||||
# Do not try to perform the PUT request when the Content-Type does not
|
||||
# look like a MIME type
|
||||
server.halt 415 unless content_type.match(/^.+\/.+/i)
|
||||
server.halt 400 if server.env["HTTP_CONTENT_RANGE"]
|
||||
server.halt 409, "Conflict" if has_name_collision?(user, directory, key)
|
||||
|
||||
@ -506,10 +509,5 @@ module RemoteStorage
|
||||
items
|
||||
end
|
||||
|
||||
def validate_content_type(content_type)
|
||||
# Do not try to perform the PUT request when the Content-Type does not
|
||||
# look like a MIME type
|
||||
server.halt 415 unless content_type.match(/^.+\/.+/i)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -16,8 +16,6 @@ module RemoteStorage
|
||||
end
|
||||
|
||||
def do_put_request(url, data, content_type)
|
||||
validate_content_type(content_type)
|
||||
|
||||
deal_with_unauthorized_requests do
|
||||
md5 = Digest::MD5.base64digest(data)
|
||||
authorization_headers = authorization_headers_for(
|
||||
|
Loading…
x
Reference in New Issue
Block a user