sendingtk / chatwoot

Other
52 stars 74 forks source link

Os anexos não são salvos no canal de e-mail #147

Open MaoBueno opened 2 months ago

MaoBueno commented 2 months ago

Describe the bug

Olá Ao receber um e-mail com anexo você pode ver o e-mail no chatwoot mas não pode baixar o anexo, isso só acontece com e-mails recebidos, pois com e-mails enviados você pode baixar anexos O problema é que eles não podem ser baixados porque o arquivo não existe, embora haja uma referência no banco de dados, ele não é salvo no sistema de arquivos

Versão do Chatwoot: v3.12.7 Ambiente: Docker (Portainer) Provedor de nuvem: hetzner

To Reproduce

  1. O e-mail chega corretamente email

2.Ao baixar o arquivo não existe archivo-no-existe

  1. Ao obter o blob_id e sua respectiva chave para verificar o arquivo no sistema de arquivos local, ele não foi salvo imagen

  2. A chave do arquivo é: ippik1xpsge4aiujcjrrvwu4oih0 imagen

  3. sabemos que o caminho do arquivo é app/storage/ip/pi (primeiros caracteres da chave) e não está no sistema de arquivos local imagen

  4. Os logs não mostram erros ao receber o email logs-app

[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}

Obs: quando recebo arquivos de outros canais se eles estão salvos corretamente, ou quando o anexo é de um e-mail enviado ele também é salvo corretamente, o erro é quando é recebido um e-mail com arquivo anexado

Expected behavior

O que se espera é que o anexo que vem no e-mail possa ser baixado

Environment

Docker

Cloud Provider

Other [please specify in the description]

Platform

Browser

Operating system

No response

Browser and version

No response

Docker (if applicable)

~# docker version

Client: Docker Engine - Community Version: 25.0.5 API version: 1.44 Go version: go1.21.8 Git commit: 5dc9bcc Built: Tue Mar 19 15:05:10 2024 OS/Arch: linux/amd64 Context: default

Server: Docker Engine - Community Engine: Version: 25.0.5 API version: 1.44 (minimum version 1.24) Go version: go1.21.8 Git commit: e63daec Built: Tue Mar 19 15:05:10 2024 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.6.28 GitCommit: ae07eda36dd25f8a1b98dfbf587313b99c0190bb runc: Version: 1.1.12 GitCommit: v1.1.12-0-g51d5e94 docker-init: Version: 0.19.0 GitCommit: de40ad0

docker info

Client: Docker Engine - Community Version: 25.0.5 Context: default Debug Mode: false Plugins: buildx: Docker Buildx (Docker Inc.) Version: v0.13.1 Path: /usr/libexec/docker/cli-plugins/docker-buildx compose: Docker Compose (Docker Inc.) Version: v2.25.0 Path: /usr/libexec/docker/cli-plugins/docker-compose

Server: Containers: 19 Running: 18 Paused: 1 Stopped: 0 Images: 168 Server Version: 25.0.5 Storage Driver: overlay2 Backing Filesystem: extfs Supports d_type: true Using metacopy: false Native Overlay Diff: true userxattr: false Logging Driver: json-file Cgroup Driver: systemd Cgroup Version: 2 Plugins: Volume: local Network: bridge host ipvlan macvlan null overlay Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog Swarm: active NodeID: koaicju89ekxlvxl7**** Is Manager: true ClusterID: xtacofutlhkyvkyf**** Managers: 1 Nodes: 1 Default Address Pool: *** SubnetSize: 24 Data Path Port: Orchestration: Task History Retention Limit: 5 Raft: Snapshot Interval: 10000 Number of Old Snapshots to Retain: 0 Heartbeat Tick: 1 Election Tick: 10 Dispatcher: Heartbeat Period: 5 seconds CA Configuration: Expiry Duration: 3 months Force Rotate: 0 Autolock Managers: false Root Rotation In Progress: false Node Address: **** Manager Addresses:


Runtimes: io.containerd.runc.v2 runc Default Runtime: runc Init Binary: docker-init containerd version: ae07eda36dd25f8a1b98dfbf587313b** runc version: v1.1.12-0-g51d5e94 init version: de4 Security Options: apparmor seccomp Profile: builtin cgroupns Kernel Version: 5.15.0-107-generic Operating System: Ubuntu 22.04.4 LTS OSType: linux Architecture: x86_64 CPUs: 4 Total Memory: 15.25GiB Name: man* ID: c1cd86d7-397b-4e5b-**7 Docker Root Dir: /var/lib/docker Debug Mode: false Experimental: false Insecure Registries:


Live Restore Enabled: false

Additional context

No response

tronne commented 3 weeks ago

I have exactly the same problem

sendingtk commented 3 weeks ago

https://github.com/sendingtk/chatwoot/pull/171