Skip to content

Commit

Permalink
Include the name of the file if it fails to upload
Browse files Browse the repository at this point in the history
  • Loading branch information
awead committed Jan 13, 2016
1 parent df78227 commit 52d41f8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Expand Up @@ -106,7 +106,7 @@ def create_from_upload(params)
end
rescue => error
logger.error "GenericFilesController::create rescued #{error.class}\n\t#{error}\n #{error.backtrace.join("\n")}\n\n"
json_error "Error occurred while creating generic file."
json_error "Error occurred while creating generic file.", file.original_filename
ensure
# remove the tempfile (only if it is a temp file)
file.tempfile.delete if file.respond_to?(:tempfile)
Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/generic_files_controller_spec.rb
Expand Up @@ -133,7 +133,7 @@

file = fixture_file_upload('/world.png', 'image/png')
xhr :post, :create, files: [file], Filename: "The world", batch_id: "sample_batch_id", permission: { "group" => { "public" => "read" } }, terms_of_service: "1"
expect(response.body).to include("Error occurred while creating generic file.")
expect(response.body).to include("Error occurred while creating generic file.", "world.png")
end
end
end
Expand Down

0 comments on commit 52d41f8

Please sign in to comment.