Closed Bug 1844747 Opened 2 years ago Closed 2 years ago

createTag does not accept - and _ in key

Categories

(Thunderbird :: Add-Ons: Extensions API, defect)

Thunderbird 115
defect

Tracking

(thunderbird_esr115 fixed, thunderbird119 wontfix)

RESOLVED FIXED
120 Branch
Tracking Status
thunderbird_esr115 --- fixed
thunderbird119 --- wontfix

People

(Reporter: jhh, Assigned: john)

Details

Attachments

(1 file)

Steps to reproduce:

I tried to create a new tag using messenger.messages.createTag(key,tag,color) with key="a_tag-thing" and tag "A Tag-Thing" (and color = "#000000").

Actual results:

I get the following error:

Error: Type error for parameter key (String "a_tag-thing" must match /^[$a-zA-Z0-9]+$/) for messages.createTag.

Expected results:

When creating the same tag using the "Manage Tags..." it actually does get assigned the internal key "a_tag-thing". So the Webextensions API appears to be more strict than what is used internally.

In this case this is (somewhat) of a problem, because an extension cannot create tags (with messenger.messages.createTag()) using the same key encoding as "Manage tags..." would do when the same complex tag containing spaces or hyphens is added. This creates compatibility issues when importing Xbox files with tag information stored in X-Mozilla-Keys created using messenger.messages.createTag() in a new profile where tags are added using "Manage tags...".

Flags: needinfo?(john)

Thanks for your report. I will investigate the situation.

The internal limitation seems to be coming from here:
https://searchfox.org/comm-central/rev/5da82e895f27d3c6a8bf8567340c08a3dde6362b/mailnews/base/src/nsMsgTagService.cpp#211

We should be able to clone that into the API

Assignee: nobody → john
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Component: Untriaged → Add-Ons: Extensions API
Flags: needinfo?(john)

Pushed by kaie@kuix.de:
https://hg.mozilla.org/comm-central/rev/0601e96e3d00
Adjust tags API to support keys also supported by Thunderbird itself. r=mkmelin

Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 120 Branch

Comment on attachment 9355136 [details]
Bug 1844747 - Adjust tags API to support keys also supported by Thunderbird itself. r=darktrojan

[Approval Request Comment]
Regression caused by (bug #):
User impact if declined: Not all tags can be accessed/modified thru the API
Testing completed (on c-c, etc.): Full Beta cycle
Risk to taking this patch (and alternatives if risky): Adjusting the pattern match and adding a test. Applies cleanly, should not cause issues.

Attachment #9355136 - Flags: approval-comm-esr115?

Comment on attachment 9355136 [details]
Bug 1844747 - Adjust tags API to support keys also supported by Thunderbird itself. r=darktrojan

[Triage Comment]
Approved for esr115

Attachment #9355136 - Flags: approval-comm-esr115? → approval-comm-esr115+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: