Skip to content

Commit

Permalink
Merge pull request #4526 from brave-intl/revert-filename
Browse files Browse the repository at this point in the history
get rid of binwrite
  • Loading branch information
jlbyrne authored Nov 12, 2024
2 parents 12f8a4e + 95f425b commit b587109
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/controllers/api/nextv1/contribution_page_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit b587109

Please sign in to comment.