Hello
When you receive an email with an attachment you can see the email in chatwoot but you cannot download the attachment, this only happens with received emails, as with sent emails you can download attachments
The problem is that they cannot be downloaded because the file does not exist, although there is a reference in the database, it is not saved in the file system
When obtaining the blob_id and its respective key to verify the file in the local file system, it was not saved
The file key is: ippik1xpsge4aiujcjrrvwu4oih0
We know that the file path is app/storage/ip/pi (first characters of the key) and it is not in the local file system
The logs do not show errors when receiving email
[2024-09-23T23:47:08.448893 #1] INFO -- : [ActiveJob] [Inboxes::FetchImapEmailsJob] [9adb0f57-a6dd-48a8-a06a-35fde5072772] Enqueued ActionCableBroadcastJob (Job ID: a7b25585-ce20-496f-9c18-1e333a027559) to Sidekiq(critical) with arguments: ["YAjUnK5Ssq9GyNe8qEq2PfEc", "P2xu3Bd2VMaHJuATDcLkzrLL", "h5LTNE17TapPmEHajXLY1dfQ", "Rm457HawvAxgMEidNqjywcM9", "3FyqZ1cVZbZpmnw48chRh7qp", "NKXBNnAkwDsCAxuJ1qq6dtXs"], "conversation.created", {:additional_attributes=>{"source"=>"email", "in_reply_to"=>nil, "mail_subject"=>"Test file", "initiated_at"=>{"timestamp"=>"2024-09-23T21:47:08.224Z"}}, :can_reply=>true, :channel=>"Channel::Email", :contact_inbox=>#<GlobalID:0x00007f4338a0eec0 @uri=#<URI::GID gid://chatwoot/ContactInbox/6837>>, :id=>7158, :inbox_id=>18, :messages=>[{:id=>66857, :content=>"This is a test\n\n-- \n\n*Mauricio Bueno Osorio*Ing. Sistemas y Computación\nCelular: 310471****", :account_id=>2, :inbox_id=>18, :conversation_id=>7158, :message_type=>0, :created_at=>1727128028, :updated_at=>Mon, 23 Sep 2024 21:47:08.337512000 UTC +00:00, :private=>false, :status=>"sent", :source_id=>"CAO=SDLhMrbSGn6VzWYY2+7vz=qCt627d2s5UNFhDZhfOaGKZ2A@mail.gmail.com", :content_type=>"incoming_email", :content_attributes=>{"email"=>{"bcc"=>nil, "cc"=>nil, "content_type"=>"multipart/mixed; boundary=00000000000079a6550622d052a2", "date"=>"2024-09-23T16:45:55-05:00", "from"=>["mauroalterna****@gmail.com"], "html_content"=>{"full"=>"<div dir=\"ltr\">This is a test<br clear=\"all\"><div><br><span class=\"gmail_signature_prefix\">-- </span><br><div dir=\"ltr\" class=\"gmail_signature\" data-smartmail=\"gmail_signature\"><div dir=\"ltr\"><b>Mauricio Bueno Osorio<br></b>Ing. Sistemas y Computación<br>Celular: 310471****<br></div></div></div></div>\r\n", "reply"=>"This is a test\n\n--\nMauricio Bueno OsorioIng. Sistemas y Computación\nCelular: 310471****", "quoted"=>"This is a test"}, "in_reply_to"=>nil, "message_id"=>"CAO=SDLhMrbSGn6VzWYY2+7vz=qCt627d2s5UNFhDZhfOaGKZ2A@mail.gmail.com", "multipart"=>true, "number_of_attachments"=>1, "subject"=>"Test file", "text_content"=>{"full"=>"This is a test\r\n\r\n-- \r\n\r\n*Mauricio Bueno Osorio*Ing. Sistemas y Computación\r\nCelular: 310471****\r\n", "reply"=>"This is a test\n\n-- \n\n*Mauricio Bueno Osorio*Ing. Sistemas y Computación\nCelular: 310471****", "quoted"=>"This is a test"}, "to"=>["info@*****.com"]}, "cc_email"=>nil, "bcc_email"=>nil}, :sender_type=>"Contact", :sender_id=>5446, :external_source_ids=>{}, :additional_attributes=>{}, :processed_message_content=>"This is a test", :sentiment=>{}, :conversation=>{:assignee_id=>nil, :unread_count=>1, :last_activity_at=>1727128028, :contact_inbox=>{:source_id=>"mauroalterna****@gmail.com"}}, :attachments=>[{:id=>5408, :message_id=>66857, :file_type=>"file", :account_id=>2, :extension=>nil, :data_url=>"https://desk.vi*****.com/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBcmM1IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--ea774d0c014a984685645aa58c2a36c6b86a6322/energia-limpia.pdf", :thumb_url=>"", :file_size=>760025, :width=>nil, :height=>nil}], :sender=>{:additional_attributes=>{"source_id"=>"email:CAO=SDLjZ3Tt8gg=-y8SVcBD+tA1_PrtPUVudh+V6Sa_ZThwLCQ@mail.gmail.com"}, :custom_attributes=>{}, :email=>"mauroalterna****@gmail.com", :id=>5446, :identifier=>nil, :name=>"Mauricio Bueno", :phone_number=>nil, :thumbnail=>"", :type=>"contact"}}], :labels=>[], :meta=>{:sender=>{:additional_attributes=>{"source_id"=>"email:CAO=SDLjZ3Tt8gg=-y8SVcBD+tA1_PrtPUVudh+V6Sa_ZThwLCQ@mail.gmail.com"}, :custom_attributes=>{}, :email=>"mauroalterna****@gmail.com", :id=>5446, :identifier=>nil, :name=>"Mauricio Bueno", :phone_number=>nil, :thumbnail=>"", :type=>"contact"}, :assignee=>nil, :team=>nil, :hmac_verified=>false}, :status=>"open", :custom_attributes=>{}, :snoozed_until=>nil, :unread_count=>1, :first_reply_created_at=>nil, :priority=>nil, :waiting_since=>1727128028, :agent_last_seen_at=>0, :contact_last_seen_at=>0, :last_activity_at=>1727128028, :timestamp=>1727128028, :created_at=>1727128028, :account_id=>2}
Note: when I receive files from other channels if they are saved correctly, or when the attachment is from a sent email it is also saved correctly, the error is when an email is received with an attached file
Expected behavior
What is expected is that the attachment that comes in the email can be downloaded
Describe the bug
Hello When you receive an email with an attachment you can see the email in chatwoot but you cannot download the attachment, this only happens with received emails, as with sent emails you can download attachments The problem is that they cannot be downloaded because the file does not exist, although there is a reference in the database, it is not saved in the file system
Environment: Docker (Portainer) Cloud provider: hetzner
To Reproduce
The email arrives correctly
When downloading the file does not exist
When obtaining the blob_id and its respective key to verify the file in the local file system, it was not saved
The file key is: ippik1xpsge4aiujcjrrvwu4oih0
We know that the file path is app/storage/ip/pi (first characters of the key) and it is not in the local file system
The logs do not show errors when receiving email
[2024-09-23T23:47:08.448893 #1] INFO -- : [ActiveJob] [Inboxes::FetchImapEmailsJob] [9adb0f57-a6dd-48a8-a06a-35fde5072772] Enqueued ActionCableBroadcastJob (Job ID: a7b25585-ce20-496f-9c18-1e333a027559) to Sidekiq(critical) with arguments: ["YAjUnK5Ssq9GyNe8qEq2PfEc", "P2xu3Bd2VMaHJuATDcLkzrLL", "h5LTNE17TapPmEHajXLY1dfQ", "Rm457HawvAxgMEidNqjywcM9", "3FyqZ1cVZbZpmnw48chRh7qp", "NKXBNnAkwDsCAxuJ1qq6dtXs"], "conversation.created", {:additional_attributes=>{"source"=>"email", "in_reply_to"=>nil, "mail_subject"=>"Test file", "initiated_at"=>{"timestamp"=>"2024-09-23T21:47:08.224Z"}}, :can_reply=>true, :channel=>"Channel::Email", :contact_inbox=>#<GlobalID:0x00007f4338a0eec0 @uri=#<URI::GID gid://chatwoot/ContactInbox/6837>>, :id=>7158, :inbox_id=>18, :messages=>[{:id=>66857, :content=>"This is a test\n\n-- \n\n*Mauricio Bueno Osorio*Ing. Sistemas y Computación\nCelular: 310471****", :account_id=>2, :inbox_id=>18, :conversation_id=>7158, :message_type=>0, :created_at=>1727128028, :updated_at=>Mon, 23 Sep 2024 21:47:08.337512000 UTC +00:00, :private=>false, :status=>"sent", :source_id=>"CAO=SDLhMrbSGn6VzWYY2+7vz=qCt627d2s5UNFhDZhfOaGKZ2A@mail.gmail.com", :content_type=>"incoming_email", :content_attributes=>{"email"=>{"bcc"=>nil, "cc"=>nil, "content_type"=>"multipart/mixed; boundary=00000000000079a6550622d052a2", "date"=>"2024-09-23T16:45:55-05:00", "from"=>["mauroalterna****@gmail.com"], "html_content"=>{"full"=>"<div dir=\"ltr\">This is a test<br clear=\"all\"><div><br><span class=\"gmail_signature_prefix\">-- </span><br><div dir=\"ltr\" class=\"gmail_signature\" data-smartmail=\"gmail_signature\"><div dir=\"ltr\"><b>Mauricio Bueno Osorio<br></b>Ing. Sistemas y Computación<br>Celular: 310471****<br></div></div></div></div>\r\n", "reply"=>"This is a test\n\n--\nMauricio Bueno OsorioIng. Sistemas y Computación\nCelular: 310471****", "quoted"=>"This is a test"}, "in_reply_to"=>nil, "message_id"=>"CAO=SDLhMrbSGn6VzWYY2+7vz=qCt627d2s5UNFhDZhfOaGKZ2A@mail.gmail.com", "multipart"=>true, "number_of_attachments"=>1, "subject"=>"Test file", "text_content"=>{"full"=>"This is a test\r\n\r\n-- \r\n\r\n*Mauricio Bueno Osorio*Ing. Sistemas y Computación\r\nCelular: 310471****\r\n", "reply"=>"This is a test\n\n-- \n\n*Mauricio Bueno Osorio*Ing. Sistemas y Computación\nCelular: 310471****", "quoted"=>"This is a test"}, "to"=>["info@*****.com"]}, "cc_email"=>nil, "bcc_email"=>nil}, :sender_type=>"Contact", :sender_id=>5446, :external_source_ids=>{}, :additional_attributes=>{}, :processed_message_content=>"This is a test", :sentiment=>{}, :conversation=>{:assignee_id=>nil, :unread_count=>1, :last_activity_at=>1727128028, :contact_inbox=>{:source_id=>"mauroalterna****@gmail.com"}}, :attachments=>[{:id=>5408, :message_id=>66857, :file_type=>"file", :account_id=>2, :extension=>nil, :data_url=>"https://desk.vi*****.com/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBcmM1IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--ea774d0c014a984685645aa58c2a36c6b86a6322/energia-limpia.pdf", :thumb_url=>"", :file_size=>760025, :width=>nil, :height=>nil}], :sender=>{:additional_attributes=>{"source_id"=>"email:CAO=SDLjZ3Tt8gg=-y8SVcBD+tA1_PrtPUVudh+V6Sa_ZThwLCQ@mail.gmail.com"}, :custom_attributes=>{}, :email=>"mauroalterna****@gmail.com", :id=>5446, :identifier=>nil, :name=>"Mauricio Bueno", :phone_number=>nil, :thumbnail=>"", :type=>"contact"}}], :labels=>[], :meta=>{:sender=>{:additional_attributes=>{"source_id"=>"email:CAO=SDLjZ3Tt8gg=-y8SVcBD+tA1_PrtPUVudh+V6Sa_ZThwLCQ@mail.gmail.com"}, :custom_attributes=>{}, :email=>"mauroalterna****@gmail.com", :id=>5446, :identifier=>nil, :name=>"Mauricio Bueno", :phone_number=>nil, :thumbnail=>"", :type=>"contact"}, :assignee=>nil, :team=>nil, :hmac_verified=>false}, :status=>"open", :custom_attributes=>{}, :snoozed_until=>nil, :unread_count=>1, :first_reply_created_at=>nil, :priority=>nil, :waiting_since=>1727128028, :agent_last_seen_at=>0, :contact_last_seen_at=>0, :last_activity_at=>1727128028, :timestamp=>1727128028, :created_at=>1727128028, :account_id=>2}
Note: when I receive files from other channels if they are saved correctly, or when the attachment is from a sent email it is also saved correctly, the error is when an email is received with an attached file
Expected behavior
What is expected is that the attachment that comes in the email can be downloaded
Environment
Docker
Cloud Provider
Other [please specify in the description]
Platform
None
Operating system
No response
Browser and version
No response
Docker (if applicable)
Additional context
No response