Commit f9899c93 authored by Безуглый Андрей's avatar Безуглый Андрей
Browse files

FIXED:

* As UB `fs.readFileSync` now returns `Buffer` and not string, accounted that in code.  Old UB version would still work,
  because the code checks if it is buffer or string.
parent 47a5afb4
......@@ -6,7 +6,7 @@
<option name="SMART_TABS" value="true" />
</value>
</option>
<JSCodeStyleSettings>
<JSCodeStyleSettings version="0">
<option name="USE_SEMICOLON_AFTER_STATEMENT" value="false" />
<option name="FORCE_SEMICOLON_STYLE" value="true" />
</JSCodeStyleSettings>
......
# 3.0.3
FIXED:
* As UB `fs.readFileSync` now returns `Buffer` and not string, accounted that in code. Old UB version would still work,
because the code checks if it is buffer or string.
# 3.0.2
FIXED:
......
......@@ -179,8 +179,15 @@ function loadLocaleFromCsv(session, dirName, locale, entityName, attrs, keyAttrs
function loadCsvAsArray(fileName, startRow = 1, delimiter = ';') {
let fContent = fs.readFileSync(fileName, 'utf8')
if (!fContent) throw new Error('File ' + fileName + ' is empty or not exist')
fContent = fContent.trim()
if (!fContent) {
throw new Error(`File ${fileName} is empty or not exist`)
}
if (fContent instanceof Buffer) {
fContent = fContent.toString('utf8')
}
if (typeof fContent === 'string') {
fContent = fContent.trim()
}
const csvData = csv.parse(fContent, delimiter)
if (!Array.isArray(csvData)) throw new Error(`Invalid CSV format or file ${fileName} not found`)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment