Skip to content

Issue with Escaped Commas - using header.append with clipboard #386

Closed

Description

@infinitelyintrigued

Hi,

I have the following line in my Reply template:

%dateformat(" - a, b d, Y H:M",toclipboard)% %header.append(subject,clipboard)%

However, the result becomes:

 Thu\, Jul 31\, 2025 13:09

How can I remove the backslashes before the commas?

Activity

  1. RealRaven2000 commented on Aug 1, 2025

    @RealRaven2000
    Owner

    I just tested your script, not sure where these backslashes come from. They are clearly not in the clipboard, so they must be generated during header.append...

    looks like a bug to me - not sure if there is a workaround. Let me investigate!

  2. infinitelyintrigued commented on Aug 1, 2025

    @infinitelyintrigued
    Author

    Thank you. No rush. In the meantime, I’ve removed those commas from the template.

    I remember the template was working correctly when I was still using Thunderbird 128 ESR. I started noticing the issue after upgrading to 140 ESR. I’m not sure if it’s related, though.

  3. RealRaven2000 commented on Aug 1, 2025

    @RealRaven2000
    Owner

    Apparently all commas coming from clipboard must be escaped due to issue #344.

    here is the code in the modifyHeader function, smartTemplate-overlay.js line 2571:

              for (let a of multiArgs) {
                // support adding multiple string arguments
                if (a == "clipboard") {
                  if (!util.hasLicense() || util.licenseInfo.keyType == 2) {
                    util.addUsedPremiumFunction("clipboard");
                  } else {
                    textParamList += util.clipboardRead("plain").replaceAll(",", "\\,"); // [issue 344]
                  }
                }

    removing that code might have other side effects, but I am not quite sure why I would encode it in this particular place. Could be a regression...

  4. RealRaven2000 commented on Aug 1, 2025

    @RealRaven2000
    Owner

    Ok I know now why #344 was implemented: to support multiple arguments, such as:

    %header.append(subject,"[test]",clipboard,"[test2]")%

    I think escaping the commas from clipboard was a precaution to avoid wrong processing downstream. There would be a (really ugly) workaround, breaking it up into multiple calls for header.append, but it would require calling dateformat multiple times. Let me rather fix the code.

  5. changed the title [-]Issue with Escaped Commas[/-] [+]Issue with Escaped Commas - using `header.append` with `clipboard`[/+] on Aug 1, 2025
  6. RealRaven2000 commented on Aug 1, 2025

    @RealRaven2000
    Owner

    Can you test this version:

    smartTemplate-fx-4.13.1pre6.zip

    So you can now also write:

    %header.append(subject,"read: ",clipboard)%


    To try out this version, download the zip file and then drag it into Thunderbird Add-ons Manager (without extracting)

  7. infinitelyintrigued commented on Aug 1, 2025

    @infinitelyintrigued
    Author

    It's working!

  8. RealRaven2000 commented on Aug 31, 2025

    @RealRaven2000
    Owner

    Fixed in 4.14 - Published 30/08/2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions