Skip to content

Commit 030e675

Browse files
Tim Hinderliterdanielsdeleo
authored andcommitted
raise 404 instead of 400 if unexpected checksum is uploaded to a sandbox
1 parent eb41e26 commit 030e675

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

chef-server-api/app/controllers/sandboxes.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def create
8686
self.status = 201
8787
location = absolute_slice_url(:sandbox, :sandbox_id => new_sandbox.guid)
8888
headers['Location'] = location
89-
result = { 'uri' => location, 'checksums' => result_checksums }
89+
result = { 'uri' => location, 'checksums' => result_checksums, 'sandbox_id' => new_sandbox.guid }
9090
#result = { 'uri' => location }
9191

9292
display result
@@ -102,7 +102,7 @@ def upload_checksum
102102
existing_sandbox = Chef::Sandbox.cdb_load(sandbox_guid)
103103
raise NotFound, "cannot find sandbox with guid #{sandbox_guid}" unless existing_sandbox
104104

105-
raise BadRequest, "checksum #{checksum} isn't a part of sandbox #{sandbox_guid}" unless existing_sandbox.checksums.member?(checksum)
105+
raise NotFound, "checksum #{checksum} isn't a part of sandbox #{sandbox_guid}" unless existing_sandbox.checksums.member?(checksum)
106106

107107
src = params[:file][:tempfile].path
108108

@@ -134,7 +134,7 @@ def update
134134
existing_sandbox.checksums.each do |checksum|
135135
checksum_filename = sandbox_checksum_location(existing_sandbox.guid, checksum)
136136
if !File.exists?(checksum_filename)
137-
raise BadRequest, "cannot update sandbox #{sandbox_id}: checksum #{checksum} was not uploaded"
137+
raise BadRequest, "cannot update sandbox #{params[:sandbox_id]}: checksum #{checksum} was not uploaded"
138138
end
139139
end
140140

0 commit comments

Comments
 (0)