From fecb0c67a5d3b91367d99235a7c34a9047f33387 Mon Sep 17 00:00:00 2001 From: Matt Date: Tue, 31 Dec 2024 08:03:10 -0600 Subject: [PATCH] add filename to upload error message --- app/controllers/posts_controller.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb index 92a5287..a31208d 100644 --- a/app/controllers/posts_controller.rb +++ b/app/controllers/posts_controller.rb @@ -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"