Skip to content

Commit

Permalink
More debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
parterburn committed Jan 8, 2024
1 parent ce5ad11 commit bed4878
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions app/lib/email_processor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,20 @@ def process
@attachments.each do |attachment|
next unless attachment.present?

# Make sure attachments are at least 20kb so we're not saving a bunch of signature/footer images\
file_size = File.size?(attachment.tempfile).to_i

if @user.id == 1
# Temp log for debugging
p "*" * 100
p attachment
p file_size
p attachment.content_type
p attachment&.original_filename
p (attachment.content_type == "application/octet-stream" || attachment.content_type =~ /^image\/(png|jpe?g|webp|gif|heic|heif)$/i || attachment&.original_filename.to_s =~ /^(.+\.(heic|heif))$/i || attachment&.filename.to_s =~ /^(.+\.(heic|heif))$/i) && file_size > 20000
p "*" * 100
end

# Make sure attachments are at least 20kb so we're not saving a bunch of signature/footer images\
file_size = attachment.size.presence || File.size?(attachment.tempfile).to_i

# skip signature images
next if @user.id == 293 && (attachment&.original_filename.to_s == "cropped-IMG-0719-300x86.jpeg" || attachment&.filename.to_s == "cropped-IMG-0719-300x86.jpeg")
next if @user.id == 10836 && (attachment&.original_filename.to_s == "B_Logo.png" || attachment&.filename.to_s == "B_Logo.png")
Expand Down

0 comments on commit bed4878

Please sign in to comment.