Images broken when adding Knowledgebase articles to tickets

Infos:

  • Used Zammad version: 3.3.x
  • Used Zammad installation source: (source, package, …): ubuntu package
  • Operating system: ubuntu lts 18.04
  • Browser + version: Firefox/Chrome latest

Expected behavior:

  • Add an existing knowledgebase article to a ticket using the ‘??’ shortkey. Preview should show the KB article

Actual behavior:

  • all images are showing up as broken image in the preview. The KB article itself displays correctly using the kb direct link.
  • image will also not be present in the answermail

Steps to reproduce the behavior:

  • link a kb article containing images
1 Like

from the production.log:

I, [2020-04-01T11:51:00.963739 #116349-47417937673400]  INFO -- : Started POST "/api/v1/knowledge_bases/search" for 192.168.10.45 at 2020-04-01 11:51:00 +0200
I, [2020-04-01T11:51:00.971213 #116349-47417937673400]  INFO -- : Processing by KnowledgeBase::SearchController#search as JSON
I, [2020-04-01T11:51:00.971363 #116349-47417937673400]  INFO -- :   Parameters: {"query"=>"how to", "flavor"=>"agent", "index"=>"KnowledgeBase::Answer::Translation", "url_type"=>"agent", "highlight_enabled"=>false}
I, [2020-04-01T11:51:00.979728 #116349-47417937673400]  INFO -- : # curl -X get "http://127.0.0.1:9200/zammad_production_knowledge_base_answer_translation/_doc/_search"
I, [2020-04-01T11:51:01.001075 #116349-47417937673400]  INFO -- : # 200
I, [2020-04-01T11:51:01.001206 #116349-47417937673400]  INFO -- : ... _doc 2
I, [2020-04-01T11:51:01.001263 #116349-47417937673400]  INFO -- : ... _doc 1
I, [2020-04-01T11:51:01.001309 #116349-47417937673400]  INFO -- : ... _doc 15
I, [2020-04-01T11:51:01.001370 #116349-47417937673400]  INFO -- : ... _doc 33
I, [2020-04-01T11:51:01.001430 #116349-47417937673400]  INFO -- : ... _doc 3
I, [2020-04-01T11:51:01.001491 #116349-47417937673400]  INFO -- : ... _doc 26
I, [2020-04-01T11:51:01.001552 #116349-47417937673400]  INFO -- : ... _doc 25
I, [2020-04-01T11:51:01.001613 #116349-47417937673400]  INFO -- : ... _doc 12
I, [2020-04-01T11:51:01.130908 #116349-47417937673400]  INFO -- : Completed 200 OK in 159ms (Views: 1.4ms | ActiveRecord: 20.9ms)
I, [2020-04-01T11:51:03.119201 #116345-47417937673060]  INFO -- : Started PUT "/api/v1/taskbar/3653" for 192.168.10.45 at 2020-04-01 11:51:03 +0200
I, [2020-04-01T11:51:03.132754 #116345-47417937673060]  INFO -- : Processing by TaskbarController#update as JSON
I, [2020-04-01T11:51:03.133228 #116345-47417937673060]  INFO -- :   Parameters: {"key"=>"Ticket-1835", "client_id"=>"123", "callback"=>"TicketZoom", "state"=>{"ticket"=>{}, "article"=>{"body"=>"[FILTERED]", "from"=>"Michael Trojacher", "ticket_id"=>"1835", "content_type"=>"text/html", "sender_id"=>"1", "type_id"=>"10", "form_id"=>"734536527"}}, "params"=>{"ticket_id"=>"1835", "shown"=>true}, "prio"=>184, "notify"=>false, "active"=>true, "attachments"=>[], "updated_at"=>"2020-04-01T09:47:54.091Z", "id"=>"3653"}
I, [2020-04-01T11:51:03.310181 #116345-47417937673060]  INFO -- : Completed 200 OK in 177ms (Views: 0.7ms | ActiveRecord: 9.9ms)
I, [2020-04-01T11:51:07.507596 #116353-47417937672920]  INFO -- : Started GET "/api/v1/knowledge_bases/1/answers/2?include_contents=2&_=1585732975121" for 192.168.10.45 at 2020-04-01 11:51:07 +0200
I, [2020-04-01T11:51:07.514228 #116353-47417937672920]  INFO -- : Processing by KnowledgeBase::AnswersController#show as JSON
I, [2020-04-01T11:51:07.514336 #116353-47417937672920]  INFO -- :   Parameters: {"include_contents"=>"2", "_"=>"1585732975121", "knowledge_base_id"=>"1", "id"=>"2"}
I, [2020-04-01T11:51:07.848997 #116353-47417937672920]  INFO -- : Completed 200 OK in 335ms (Views: 70.6ms | ActiveRecord: 20.7ms)
I, [2020-04-01T11:51:07.872932 #116353-47417937673400]  INFO -- : Started GET "/api/v1/attachments/8695" for 192.168.10.45 at 2020-04-01 11:51:07 +0200
I, [2020-04-01T11:51:07.872932 #116345-47417937672480]  INFO -- : Started GET "/api/v1/attachments/8697" for 192.168.10.45 at 2020-04-01 11:51:07 +0200
I, [2020-04-01T11:51:07.877470 #116349-47417937672920]  INFO -- : Started GET "/api/v1/attachments/8697" for 192.168.10.45 at 2020-04-01 11:51:07 +0200
I, [2020-04-01T11:51:07.880422 #116345-47417937672480]  INFO -- : Processing by AttachmentsController#show as HTML
I, [2020-04-01T11:51:07.880540 #116345-47417937672480]  INFO -- :   Parameters: {"id"=>"8697"}
I, [2020-04-01T11:51:07.881687 #116353-47417937673400]  INFO -- : Processing by AttachmentsController#show as HTML
I, [2020-04-01T11:51:07.882000 #116353-47417937673400]  INFO -- :   Parameters: {"id"=>"8695"}
I, [2020-04-01T11:51:07.884284 #116349-47417937672920]  INFO -- : Processing by AttachmentsController#show as HTML
I, [2020-04-01T11:51:07.884395 #116349-47417937672920]  INFO -- :   Parameters: {"id"=>"8697"}
I, [2020-04-01T11:51:07.907665 #116349-47417937672920]  INFO -- :   Rendering text template
I, [2020-04-01T11:51:07.907855 #116349-47417937672920]  INFO -- :   Rendered text template (0.0ms)
I, [2020-04-01T11:51:07.908023 #116349-47417937672920]  INFO -- : Sent data image1.jpeg (0.8ms)
I, [2020-04-01T11:51:07.908263 #116345-47417937672480]  INFO -- :   Rendering text template
I, [2020-04-01T11:51:07.908412 #116345-47417937672480]  INFO -- :   Rendered text template (0.0ms)
I, [2020-04-01T11:51:07.908571 #116345-47417937672480]  INFO -- : Sent data image1.jpeg (0.8ms)
I, [2020-04-01T11:51:07.911104 #116345-47417937672480]  INFO -- : Completed 200 OK in 30ms (Views: 0.6ms | ActiveRecord: 7.3ms)
I, [2020-04-01T11:51:07.913530 #116349-47417937672920]  INFO -- : Completed 200 OK in 29ms (Views: 0.6ms | ActiveRecord: 9.3ms)
I, [2020-04-01T11:51:08.034756 #116349-47417937672360]  INFO -- : Started GET "/[object%20HTMLImageElement]" for 192.168.10.45 at 2020-04-01 11:51:08 +0200
I, [2020-04-01T11:51:08.035014 #116341-47417937672360]  INFO -- : Started GET "/api/v1/attachments/8695" for 192.168.10.45 at 2020-04-01 11:51:08 +0200
I, [2020-04-01T11:51:08.041805 #116341-47417937672360]  INFO -- : Processing by AttachmentsController#show as HTML
I, [2020-04-01T11:51:08.041945 #116341-47417937672360]  INFO -- :   Parameters: {"id"=>"8695"}
I, [2020-04-01T11:51:08.042267 #116349-47417937672360]  INFO -- : Processing by ErrorsController#routing as HTML
I, [2020-04-01T11:51:08.042501 #116349-47417937672360]  INFO -- :   Parameters: {"a"=>"[object HTMLImageElement]"}
E, [2020-04-01T11:51:08.052598 #116349-47417937672360] ERROR -- : No route matches [GET] /[object%20HTMLImageElement] (ActionController::RoutingError)

I, [2020-04-01T11:51:08.055008 #116349-47417937672360]  INFO -- :   Rendering inline template
I, [2020-04-01T11:51:08.056476 #116349-47417937672360]  INFO -- :   Rendered inline template (1.2ms)
I, [2020-04-01T11:51:08.061689 #116341-47417937672360]  INFO -- :   Rendering text template
I, [2020-04-01T11:51:08.061844 #116341-47417937672360]  INFO -- :   Rendered text template (0.0ms)
I, [2020-04-01T11:51:08.062044 #116341-47417937672360]  INFO -- : Sent data image1.jpeg (0.7ms)
I, [2020-04-01T11:51:08.062866 #116349-47417937672360]  INFO -- : Completed 404 Not Found in 20ms (Views: 2.3ms | ActiveRecord: 8.8ms)
I, [2020-04-01T11:51:08.063719 #116341-47417937672360]  INFO -- : Completed 200 OK in 22ms (Views: 0.6ms | ActiveRecord: 4.2ms)
I, [2020-04-01T11:51:08.083926 #116345-47417937672200]  INFO -- : Started GET "/[object%20HTMLImageElement]" for 192.168.10.45 at 2020-04-01 11:51:08 +0200
I, [2020-04-01T11:51:08.089685 #116345-47417937672200]  INFO -- : Processing by ErrorsController#routing as HTML
I, [2020-04-01T11:51:08.089786 #116345-47417937672200]  INFO -- :   Parameters: {"a"=>"[object HTMLImageElement]"}
E, [2020-04-01T11:51:08.094436 #116345-47417937672200] ERROR -- : No route matches [GET] /[object%20HTMLImageElement] (ActionController::RoutingError)

I, [2020-04-01T11:51:08.095094 #116345-47417937672200]  INFO -- :   Rendering inline template
I, [2020-04-01T11:51:08.095860 #116345-47417937672200]  INFO -- :   Rendered inline template (0.7ms)
I, [2020-04-01T11:51:08.097282 #116345-47417937672200]  INFO -- : Completed 404 Not Found in 7ms (Views: 1.1ms | ActiveRecord: 1.2ms)
I, [2020-04-01T11:51:08.099526 #116353-47417937673400]  INFO -- :   Rendering text template
I, [2020-04-01T11:51:08.099806 #116353-47417937673400]  INFO -- :   Rendered text template (0.0ms)
I, [2020-04-01T11:51:08.100291 #116353-47417937673400]  INFO -- : Sent data image1.jpeg (1.5ms)
I, [2020-04-01T11:51:08.102137 #116353-47417937673400]  INFO -- : Completed 200 OK in 220ms (Views: 1.3ms | ActiveRecord: 192.0ms)
I, [2020-04-01T11:51:10.346907 #116345-47417937673540]  INFO -- : Started PUT "/api/v1/taskbar/3653" for 192.168.10.45 at 2020-04-01 11:51:10 +0200
I, [2020-04-01T11:51:10.354439 #116345-47417937673540]  INFO -- : Processing by TaskbarController#update as JSON
I, [2020-04-01T11:51:10.354907 #116345-47417937673540]  INFO -- :   Parameters: {"key"=>"Ticket-1835", "client_id"=>"123", "callback"=>"TicketZoom", "state"=>{"ticket"=>{}, "article"=>{"body"=>"[FILTERED]", "from"=>"Michael Trojacher", "ticket_id"=>"1835", "content_type"=>"text/html", "sender_id"=>"1", "type_id"=>"10", "form_id"=>"734536527"}}, "params"=>{"ticket_id"=>"1835", "shown"=>true}, "prio"=>184, "notify"=>false, "active"=>true, "attachments"=>[], "updated_at"=>"2020-04-01T09:47:54.091Z", "id"=>"3653"}
I, [2020-04-01T11:51:10.403800 #116345-47417937673540]  INFO -- : Completed 200 OK in 48ms (Views: 0.7ms | ActiveRecord: 9.0ms)
I, [2020-04-01T11:51:19.017399 #116180-46957085052940]  INFO -- : execute Channel.fetch (try_count 0)...

Hi,

we have the same problem here, Zammad installation on centos 7. The image get’s a wrong link so they cannot be displayed, the url is https://name_of_server/[object%20HTMLImageElement] instead the correct attachment url.

How do you copy the images? Sounds like wrong usuage or your browser not supporting what ever you’re doing.

This proberbly isn’t rails related, but more browser related. Your developer console of the browser might be a better help here.

Hi,

thanks for your answer. I don’t copy the images, I insert them in a ticket from the kb via ??. Worked like a charm the last 11 months since we use zammad. Tried it already with different browser, usually I use firefox but doesn’t work in chrome neither.
In the kb itself the article including the images can be read nicely but as the system is not available from outside it is a nice feature to include kb articles in tickets. At least it was as long as the images were working :).
We do automatic updates on our centos server and it’s not working since two weeks or so. Seems related to one of the last updates.

We use the KB . editor and copy/paste the images in there (using DB storage) since the kb feature has been added. The images show up in the editor and in the KB articles on the kb page for non-logged in users. Only when adding the articles to the ticketanswers using the ‘??’ shortcode the images do not show up.
This has been working up until the update to zammad 3.3. This is not browser related. The behaviour is also the same for new articles written with zammad 3.3

another note: also tried to switching to file storage using rails to move the images from db to filesystem, no change in behaviour, images do not show up. i switched back to db storage afterwards, rails showed no errors during image conversion but still no dice…

Here the code that shows up in the html inspector (mutilated img tag to show up in the editor)

< img style=“max-width:100%;width: 1299px;max-width: 100%;” src="[object HTMLImageElement]" cid="KnowledgeBase::Answer::Translation::Content_body.919112442@zammad.dewetron.com">

shows up like this:

Thanks for your reply.
You can view the same images within the knowledgebase article without any issues?

Possibly the earlier image has been pasted and saved in a way Zammad or your browser(s) don’t like.
Could you please also open a developer console on e.g. Chrome or Firefox, go to the console tab, reload the Zammad application and then try to insert the KB article again within any ticket?

If it’s throwing errors, I’d love to see them.

Yes, i can see the knowledgebase article with all pasted images.

when i open the same article in the knowledgebase the html code shows
< img style=“max-width:100%;width: 1299px;max-width: 100%;” src="/api/v1/attachments/8913" cid="KnowledgeBase::Answer::Translation::Content_body.919112442@zammad.dewetron.com">

in the api response in the network - console i can see that the correct article is loaded, containing the correct attachment path. even the attachment is loaded but it is then not inserted into the answer correctly, the src="[object HTMLImageELement]" fails with an 404 error (route not found). You can see the api response in the screenshot below. then the image is loaded, but below the 404 error for the bogus [object HTML…] call

Can you please have a look at the “Console” tab within the develoepr console? It normally should show if CORS and co striked.

I have no idea how this is to be interpreted, but here goes:

Interesting, thank you.
I’m afraid this is how far “I can help”.

Looks like this object thingie lifes quite deep within your system - this is not a behaviour I can reproduce or that seems “comon”.

I’d need to dig deeper within your installation, but I’m afraid that this is out of scope. I’m sorry.

any ideas or pointers where i can poke around? or should i just hope that this will vanish with a new upgrade just like it came during an upgrade?

We have the exact same problem after upgrading to 3.3.x.

I’m happy to have an update on this topic.
We finally could reproduce it (don’t ask me what changed, I don’t know).

So this is now an issue (thanks again @mtrojacher):

This only affects images that have been added after updating to Zammad 3.3 - might also affect knowledgebase answers that have been updated after. It does not affect base64 images.

At this moment there’s no working workaround that I can provide, I’m sorry.

We’ll update above linked issue accordingly as soon as anything moves.

1 Like

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.