From 95f425bb11c1c14ba98565177aec5ce1ec45f288 Mon Sep 17 00:00:00 2001 From: Jennifer Byrne Date: Thu, 7 Nov 2024 18:06:39 -0600 Subject: [PATCH] get rid of binwrite --- app/controllers/api/nextv1/contribution_page_controller.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/controllers/api/nextv1/contribution_page_controller.rb b/app/controllers/api/nextv1/contribution_page_controller.rb index b41fdaa2b..344bd47bc 100644 --- a/app/controllers/api/nextv1/contribution_page_controller.rb +++ b/app/controllers/api/nextv1/contribution_page_controller.rb @@ -116,11 +116,15 @@ def image_properties(data) filename = Time.now.to_s.tr!(" ", "_").tr!(":", "_") + current_publisher.id temp_file = Tempfile.new([filename, extension]) - File.binwrite(temp_file.path, Base64.decode64(data)) + File.open(temp_file.path, "wb") do |f| + f.write(Base64.decode64(data.split(",")[1])) + end original_image_path = temp_file.path + temp_file.rewind new_filename = generate_filename(source_image_path: original_image_path) + { io: File.open(original_image_path), filename: new_filename + extension,