Skip to content

Commit fff2621

Browse files
author
Nikos Vasileiou
authored
Merge pull request #152 from transifex/fix-codeql-issues-20220914
Fix CodeQL security issues
2 parents 4e8cad5 + be635a1 commit fff2621

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

packages/dom/src/utils.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,5 +99,6 @@ export function stripWhitespace(str) {
9999
* @return {String}
100100
*/
101101
export function removeComments(str) {
102-
return (str || '').replace(/<!--([\s\S]*?)-->/g, '');
102+
if (!str) return '';
103+
return str.replace(/<!--[\s\S]*?(?:-->)/g, '');
103104
}

packages/native/src/cache/MemoryCache.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@ export default class MemoryCache {
1111
* @param {String} translations[key] - Translation string
1212
*/
1313
update(localeCode, translations) {
14-
if (!this.translationsByLocale[localeCode]) {
15-
this.translationsByLocale[localeCode] = {};
16-
}
17-
Object.assign(this.translationsByLocale[localeCode], translations);
14+
const prevTranslations = this.translationsByLocale[localeCode] || {};
15+
this.translationsByLocale[localeCode] = {
16+
...prevTranslations,
17+
...translations,
18+
};
1819
}
1920

2021
/**

0 commit comments

Comments
 (0)