Problem with {article.body....} variable

Hello,

I’ve just written a trigger for notify the users about ticket updates.
A a first step I used the following:
{article.body} and the notification email contains quotations marks in every line (like the documentation said).
After some discussion we decided to use {artcile.body_as_text.text2html} to remove the quotation marks.

"
Variable: #{article.body_as_text.text2html}

Body as plain text, converted to HTML without quote character (>).
"
But:
The quotation marks are still there.
Do we need some additional packages to use this variable? Is this a known issue with this varible?

  • Used Zammad version: zammad-7.1.3-1787744200.e0d0086.el9.x86_64
  • Used Zammad installation type: rpm package
  • Operating system: Alma Linux 9
  • Browser + version: Firefox 154.0

Expected behavior:

  • quotations marks removed

Actual behavior:

  • quotation marks not removed

Steps to reproduce the behavior:

  • change #{article.body} to #{article.body_as_text.text2html}

Thanks for your answers

Silvio

Did you try #{article.body_as_html} too? Should remove the ‘>’ as well - if that works we could narrow down the issue.

Thanks for the fast response,

I changed the trigger to #{article.body_as_html} and the quotation marks are still there.
I also updated Zammad to the last version and it’s the same.

My actual trigger rule:

Best

Silvio

The mail:

I just looked up my trigger and I’m using #{created_article.body_as_html} instead which doesn’t produce the >

Here’s the part that’s the issue:

The following article types are available, depending on the context:

first_internal_article

first_external_article

first_article

last_internal_article

last_external_article

last_article

created_internal_article

created_external_article

created_article

The table uses “Article” as example. Replace it with one of the aforementioned article types.

Thanks, but the result is same with #{created_article.body_as_html}.
At this stage, I wouldn’t rule out the possibility that there is a problem with my system. I would expect that other users would otherwise be reporting similar issues.
However, as the server is new and we use the standard set of rules on other systems as well, I would be interested to know where the problem is occurring.

I’ve tested all 4 options.
{article.body} - Body in plain text, converted to HTML with quote character (>) at the beginning of each line.
{article.body_as_html} - Body as HTML without quote character (>).
{article.body_as_text.text2html} - Body as plain text, converted to HTML without quote character (>).
{article.body_as_text} - Body as plain text without quote character (>).

and:
{article.body} works as expected → with quotation
{article.body_as_text} works also as expected → without quotation

both body with html options failed.

Silvio

Are you using Microsoft Exchange and Outlook or a different stack?

Cyrus as mailserver with RoundCube and Evolution as Client.
In this case → Microsoft free

Silvio

I got a wild theory but i’m not a software developer and my lunch break is over now so i can’t look into details, maybe someone else can take a look to see if my suspicion seems reasonable:

# blockquote handling
string.gsub!(%r{<blockquote(| [^>]*)>(.+?)</blockquote>}m) do
  "\n#{$2.html2text(true).gsub(%r{^(.*)$}, '&gt; \1')}\n"
end

this is part of Zammad’s way of formatting outgoing mail but it only affects the HTML tag <blockquote>
Now, i don’t know if your setup might somehow include these tags in your emails, but that would, in my opinion, at least partly explain why your behavior is so different from other people’s.

Thanks DD4PK,

Your code snippet gave me a starting point for my search. I’m not a programmer, but I do understand a bit about code, and my first thought was to have a look at the requirements.
The line “require ‘rchardet’” was my starting point.
I couldn’t find an ‘rchardet’ library on my system. A quick search turned up a ruby package.
The package was installed with a number of Ruby dependencies.
A renewed attempt using body_as_text.text2html now produces the desired result.
This raises the question for me as to why the dependencies are not defined in the RPM. The installation documentation does not list any requirements in this regard either.
I’m now wondering whether there are any other required libraries that I might stumble across by chance.

body_as_html returns the HTML body unchanged, so the > can’t come from the variable. Can you check the raw source of the received mail? If the > are only in the plain-text part, your client is just showing that part.

If this is the case, why is it working after I installed the ruby-rchardet package?

If rchardet had really been missing, Zammad wouldn’t have started at all.

The dependencies come with the install, they’re just not in your system Ruby, that’s why you didn’t find them.

Thanks for the clarification.
If I deinstall the ruby package, I can reproduce the old behavior and the quote character is shown again.
I can not see any error message in the logfile so I have no idea what is happening.

Update:
We updated to the latest version:
zammad-7.1.3-1787900519.d20f98a.el9.x86_64

now it’s working without the system ruby package.

Good to hear it works now. Sounds like something was off with the bundled gems that the update straightened out.