added utils to handle double quote replacement
deleted cypher for user.id
MODIFY
src/server/rest/v1/service/ChargingStationService.ts
src/server/rest/v1/service/ChargingStationService.ts
@@ -1544,7 +1544,7 @@ export default class ChargingStationService {
Utils.replaceSpecialCharsInCSVValueParam(param.value),
ocppParams.siteAreaName,
ocppParams.siteName,
- ].map((value) => typeof value === 'string' ? '"' + value.replace(/^"|"$/g, '') + '"' : value);
+ ].map((value) => Utils.replaceDoubleQuotes(value));
return row;
}).join(Constants.CR_LF);
return Utils.isNullOrUndefined(headers) ? Constants.CR_LF + rows : [headers, rows].join(Constants.CR_LF);
@@ -1608,7 +1608,7 @@ export default class ChargingStationService {
i18nManager.formatDateTime(chargingStation.lastReboot, 'L') + ' ' + i18nManager.formatDateTime(chargingStation.lastReboot, 'LT'),
chargingStation.maximumPower,
chargingStation.powerLimitUnit
- ].map((value) => typeof value === 'string' ? '"' + value.replace(/^"|"$/g, '') + '"' : value);
+ ].map((value) => Utils.replaceDoubleQuotes(value));
return row;
}).join(Constants.CR_LF);
return Utils.isNullOrUndefined(headers) ? Constants.CR_LF + rows : [headers, rows].join(Constants.CR_LF);

MODIFY
src/server/rest/v1/service/LoggingService.ts
src/server/rest/v1/service/LoggingService.ts
@@ -85,7 +85,7 @@ export default class LoggingService {
log.source,
log.host,
log.process
- ].map((value) => typeof value === 'string' ? '"' + value.replace(/^"|"$/g, '') + '"' : value);
+ ].map((value) => Utils.replaceDoubleQuotes(value));
return row;
}).join(Constants.CR_LF);
return Utils.isNullOrUndefined(headers) ? Constants.CR_LF + rows : [headers, rows].join(Constants.CR_LF);

MODIFY
src/server/rest/v1/service/StatisticService.ts
src/server/rest/v1/service/StatisticService.ts
@@ -652,7 +652,7 @@ export default class StatisticService {
year && year !== '0' ? year : '',
transaction.month > 0 ? transaction.month : '',
dataType === StatsDataType.PRICING ? StatisticService.getPricingCell(transaction, numberOfTransactions) : numberOfTransactions.toString()
- ].map((value) => typeof value === 'string' ? '"' + value.replace(/^"|"$/g, '') + '"' : value);
+ ].map((value) => Utils.replaceDoubleQuotes(value));
return row;
}).join(Constants.CR_LF);
return [headers, rows].join(Constants.CR_LF);

MODIFY
src/server/rest/v1/service/TransactionService.ts
src/server/rest/v1/service/TransactionService.ts
@@ -940,7 +940,7 @@ export default class TransactionService {
transaction.stop ? Math.round(transaction.stop.totalInactivitySecs ? transaction.stop.totalInactivitySecs / 60 : 0) : '',
transaction.stop ? transaction.stop.roundedPrice : '',
transaction.stop ? transaction.stop.priceUnit : ''
- ].map((value) => typeof value === 'string' ? '"' + value.replace(/^"|"$/g, '') + '"' : value);
+ ].map((value) => Utils.replaceDoubleQuotes(value));
return row;
}).join(Constants.CR_LF);
return Utils.isNullOrUndefined(headers) ? Constants.CR_LF + rows : [headers, rows].join(Constants.CR_LF);

MODIFY
src/server/rest/v1/service/UserService.ts
src/server/rest/v1/service/UserService.ts
@@ -1266,7 +1266,7 @@ export default class UserService {
// Content
const rows = users.map((user) => {
const row = [
- Cypher.hash(user.id),
+ user.id,
user.name,
user.firstName,
user.locale,
@@ -1277,7 +1277,7 @@ export default class UserService {
moment(user.createdOn).format('YYYY-MM-DD'),
moment(user.lastChangedOn).format('YYYY-MM-DD'),
(user.lastChangedBy ? Utils.buildUserFullName(user.lastChangedBy as User, false) : '')
- ].map((value) => typeof value === 'string' ? '"' + value.replace(/^"|"$/g, '') + '"' : value);
+ ].map((value) => Utils.replaceDoubleQuotes(value));
return row;
}).join(Constants.CR_LF);
return Utils.isNullOrUndefined(headers) ? Constants.CR_LF + rows : [headers, rows].join(Constants.CR_LF);

MODIFY
src/utils/Utils.ts
src/utils/Utils.ts
@@ -1443,4 +1443,8 @@ export default class Utils {
public static getHostname(): string {
return Configuration.isCloudFoundry() ? cfenv.getAppEnv().name : os.hostname();
}
+
+ public static replaceDoubleQuotes(value: any): string {
+ return typeof value === 'string' ? '"' + value.replace(/^"|"$/g, '') + '"' : value;
+ }
}

added utils to handle double quote replacement
deleted cypher for user.id