feature: common: entity: encode {,}

This commit is contained in:
coderiaser 2026-02-18 19:40:55 +02:00
parent 7ef134f46f
commit b20539ef2b
3 changed files with 11 additions and 1 deletions

View file

@ -172,7 +172,7 @@ test('cloudfunc: buildFromJSON: showDotFiles: false', (t) => {
t.end();
});
test('cloudfunc: buildFromJSON: showDotFiles: false', (t) => {
test('cloudfunc: buildFromJSON: name: {{ }}', (t) => {
const data = {
path: '/media/',
files: [{

View file

@ -2,6 +2,8 @@ const Entities = {
'&lt;': '<',
'&gt;': '>',
'&quot;': '"',
'&lcub;': '{',
'&rcub;': '}',
};
const keys = Object.keys(Entities);

View file

@ -9,6 +9,14 @@ test('cloudcmd: entity: encode', (t) => {
t.end();
});
test('cloudcmd: entity: {{}}', (t) => {
const result = entity.encode('{{}}');
const expected = '&lcub;&lcub;&rcub;&rcub;';
t.equal(result, expected, 'should encode entity');
t.end();
});
test('cloudcmd: entity: decode', (t) => {
const result = entity.decode('&lt;hello&gt; ');
const expected = '<hello> ';