Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Template Categories containing space characters disrupt the template menus #222

Closed
RealRaven2000 opened this issue Jan 6, 2023 · 3 comments
Assignees
Labels

Comments

@RealRaven2000
Copy link
Owner

When we add a category that contains space characters, this will not display the contained elements and any elements following in the definition.

In error console we see the following exception:

Uncaught DOMException: Element.querySelector: '[templateCategory=Smart Templates]' is not a valid selector

@RealRaven2000 RealRaven2000 self-assigned this Jan 6, 2023
@RealRaven2000 RealRaven2000 changed the title Template Categories with containing space will disrupt the template menu Template Categories containing space characters disrupt the template menus Jan 6, 2023
@RealRaven2000
Copy link
Owner Author

So apparently the selector (based on attribute) is failing as it is misinterpreted as a descendant selector. It's a little unfortunate that it doesn't simply return no results but also throws an exception. For a discussion on the selector issue, see this stackoverflow post.

The fix is relatively trivial, I will wrap the category in single quotes. Here is a new test version:

smartTemplate-fx-3.15.2pre3.zip

This works with Category Names that contain spaces and even Umlauts. (I haven't tested non-standard character sets yet).

To install the version, download the zip file above and then drag the file into Thunderbird Add-ons Manager (do not extract contents).

@MarkyMarkDE
Copy link
Collaborator

MarkyMarkDE commented Jan 6, 2023

So apparently the selector (based on attribute) is failing as it is misinterpreted as a descendant selector. It's a little unfortunate that it doesn't simply return no results but also throws an exception. For a discussion on the selector issue, see this stackoverflow post.

The fix is relatively trivial, I will wrap the category in single quotes. Here is a new test version:

smartTemplate-fx-3.15.2pre3.zip

This works with Category Names that contain spaces and even Umlauts. (I haven't tested non-standard character sets yet).

To install the version, download the zip file above and then drag the file into Thunderbird Add-ons Manager (do not extract contents).

Maybe you can also replace each white-space character with %20 in the same way as thunderbird do (or I'm wrong?).
Then the charset used would not matter, it may also be that we have to %-escape other special characters and umlauts in other charsets.
Sorry, german only: URL-Encoding
An other possible way can be, to rewrite such charsets as base64_encode - this is what I'm doing in php development when i write subject for php's mail() function as reason that umlauts here cause trouble (example of my code $subject = '=?ISO-8859-15?B?'.base64_encode($_POST['subject']).'?=';).

RealRaven2000 added a commit that referenced this issue Jan 13, 2023
@RealRaven2000
Copy link
Owner Author

RealRaven2000 commented Mar 5, 2023

Fixed in version 3.16 published on 6th of March 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants