Skip to content

Commit

Permalink
add filename to upload error message
Browse files Browse the repository at this point in the history
  • Loading branch information
mawise committed Dec 31, 2024
1 parent 823401a commit fecb0c6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/controllers/posts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,12 @@ def handle_form_submit(params, view)
end
rescue => e
@image.destroy
flash.now[:alert] = "Error uploading file: #{e}"
upload_filename = ""
begin
upload_filename = path_for(@image.blob).split("/").last
rescue
end
flash.now[:alert] = "Error uploading #{upload_filename}: #{e}"
end
else # attachment does not exist
flash.now[:alert] = "You did not choose a file to upload"
Expand Down

0 comments on commit fecb0c6

Please sign in to comment.