jobisoft / quicktext

An extension for Thunderbird that lets you create templates that can be easily inserted into your own emails.
Mozilla Public License 2.0
187 stars 53 forks source link

All presets get deleted when adding [[CLIPBOARD]] #324

Closed JoelPakszies closed 1 year ago

JoelPakszies commented 2 years ago
Version number of Thunderbird: 102.2.1
Version number of Quicktext: 5.2
OS you are using: Windows 10 - 21H"

The problem still exists, if I disable other add-ons - yes The problem still exists, if I use a fresh profile - yes

Our Quicktext presets get deleted on restart of Thunderbird once I implemtent the preset below. Sadly there is no error shown. We have tried on multiple PC's/Laptops. It also happened on older versions of thunderbird/quicktext, sadly I don't know what Versions we were running before. I decided to update everything, because it stopped working.

If we just use normal text we don't have a problem, I implemented this (just a cut out from the whole mail):

anfragen, wie es um Ihre Verfügbarkeit steht.

<[[CLIPBOARD]]>

Wenn Sie ein aktuelles CV

Everything else works fine. All my Scripts are working and also all other presets. I have tried just adding the text above and leaving everything else empty, but to no avail. Is there anything I am doing wrong? Or can I somehow avoid this problem, by solving the task in a different way? Thanks in advance!

JoelPakszies commented 2 years ago

After further investigation with my limited programming skills I might have found my mistake: It seems that the <>do something with the code. I implemented those so the Link in the Clipboard gets shown as a link. If I remove "<>" the Quicktext works fine, but the link cuts off too early. Is there a solution for this or something I am just not seeing?

SamuelPlentz commented 2 years ago

I can confirm the problem. This is what the saved template xml looks like:

<text shortcut="" type="0">
    <name><![CDATA[Test]]></name>
    <body><![CDATA[<[[CLIPBOARD]]>]]></body>
</text>

You can see that the content itself contains a CDATA end token ]]>. That duplicate ]]> is the problem here. Stackoverflow reference: https://stackoverflow.com/questions/223652/is-there-a-way-to-escape-a-cdata-end-token-in-xml

Workaround:

Add a space or any other character between [[CLIPBOARD]] and > like this: <[[CLIPBOARD]] >.

matttbe commented 1 year ago

Thank you for this bug report.

Please note that it is not just limited to [[CLIPBOARD]] but any tag followed by >.

On my side, I had the same issue because I was using:

Reviewed-by: [[FROM=fullname]] <[[FROM=email]]>

We can see the issue when looking at the exported XML file, two ]]> on the same line:

<body><![CDATA[Reviewed-by: [[FROM=fullname]] <[[FROM=email]]>]]></body>

Importing the exported template was not working as well with no errors or explanations.

SamuelPlentz commented 1 year ago

You are right every occurrence of ]]> is affected. @jobisoft Did you have time to think about the bugfix #329?

jobisoft commented 1 year ago

Should be fixed in the next release, which inlcudes Samuel's fix.

SamuelPlentz commented 1 year ago

I can confirm, that this is fixed in version 5.6.