1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-18 09:35:20 +02:00

Desktop: Fixes #11179: Fixed tags with same special unicode characters not matching (#11513)

This commit is contained in:
pedr 2024-12-14 08:42:36 -03:00 committed by GitHub
parent 0a5bc9647d
commit 9338c5c810
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 1 deletions

View File

@ -212,4 +212,15 @@ describe('models/Tag', () => {
expect(commonTagIds.includes(tagc.id)).toBe(true);
});
it('should allow finding tags even with special Unicode characters', async () => {
const note1 = await Note.save({});
// cSpell:disable
await Tag.setNoteTagsByTitles(note1.id, ['Ökonomie']);
const tag1 = await Tag.loadByTitle('Ökonomie');
const tag2 = await Tag.loadByTitle('ökonomie');
// cSpell:enable
expect(tag1).toStrictEqual(tag2);
});
});

View File

@ -172,7 +172,9 @@ export default class Tag extends BaseItem {
}
public static async loadByTitle(title: string): Promise<TagEntity> {
return this.loadByField('title', title, { caseInsensitive: true });
// Case insensitive doesn't work with especial Unicode characters like Ö
const lowercaseTitle = title.toLowerCase();
return this.loadByField('title', lowercaseTitle, { caseInsensitive: true });
}
public static async addNoteTagByTitle(noteId: string, tagTitle: string) {