fixed escape / unescape
MODIFY
src/server/rest/v1/service/UserService.ts
src/server/rest/v1/service/UserService.ts
@@ -1341,9 +1341,9 @@ export default class UserService {
private static async processUser(action: ServerAction, req: Request, importedUser: ImportedUser, usersToBeImported: ImportedUser[]): Promise<boolean> {
try {
const newImportedUser: ImportedUser = {
- name: Utils.escapeCsvValue(importedUser.name.toUpperCase()),
- firstName: Utils.escapeCsvValue(importedUser.firstName),
- email: Utils.escapeCsvValue(importedUser.email),
+ name: Utils.unescapeCsvValue(importedUser.name.toUpperCase()),
+ firstName: Utils.unescapeCsvValue(importedUser.firstName),
+ email: Utils.unescapeCsvValue(importedUser.email),
};
// Validate User data

MODIFY
src/utils/Utils.ts
src/utils/Utils.ts
@@ -1501,11 +1501,11 @@ export default class Utils {
public static escapeCsvValue(value: any): string {
// replace starting and ending double quotes by nothing
// replace double quotes inside value to double double quotes to display double quote in csv editor
- return typeof value === 'string' ? '"' + value.replace(/^"|"$/g, '').replace(/"/g, '""') + '"' : value;
+ return typeof value === 'string' ? '"' + value.replace(/"/g, '""') + '"' : value;
}
public static unescapeCsvValue(value: any): string {
// replace double double quotes inside value into simple double quotes
- return typeof value === 'string' ? value.replace(/""/g, '"') : value;
+ return typeof value === 'string' ? value.replace(/^"|"$/g, '').replace(/""/g, '"') : value;
}
}

fixed escape / unescape