mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-09 03:23:08 +02:00
fix: YAMLファイルへのバックスペース文字混入対策
This commit is contained in:
parent
13288e1ed8
commit
d1ea8654e6
1 changed files with 4 additions and 1 deletions
|
@ -46,7 +46,10 @@ const primaries = {
|
|||
'zh': 'CN',
|
||||
};
|
||||
|
||||
const locales = languages.reduce((a, c) => (a[c] = yaml.load(fs.readFileSync(`${__dirname}/${c}.yml`, 'utf-8')) || {}, a), {});
|
||||
// 何故か文字列にバックスペース文字が混入することがあり、YAMLが壊れるので取り除く
|
||||
const clean = (text) => text.replace(new RegExp(String.fromCodePoint(0x08), 'g'), '');
|
||||
|
||||
const locales = languages.reduce((a, c) => (a[c] = yaml.load(clean(fs.readFileSync(`${__dirname}/${c}.yml`, 'utf-8'))) || {}, a), {});
|
||||
|
||||
module.exports = Object.entries(locales)
|
||||
.reduce((a, [k ,v]) => (a[k] = (() => {
|
||||
|
|
Loading…
Reference in a new issue