158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
|
# File 'lib/fakes3/file_store.rb', line 158
def store_object(bucket, object_name, request)
filedata = ""
content_type = request.content_type || ""
match = content_type.match(/^multipart\/form-data; boundary=(.+)/)
boundary = match[1] if match
if boundary
boundary = WEBrick::HTTPUtils::dequote(boundary)
form_data = WEBrick::HTTPUtils::parse_form_data(request.body, boundary)
if form_data['file'] == nil or form_data['file'] == ""
raise WEBrick::HTTPStatus::BadRequest
end
filedata = form_data['file']
else
request.body { |chunk| filedata << chunk }
end
do_store_object(bucket, object_name, filedata, request)
end
|