From 4b94c033c446eeecb9f2e9989269fd691d9c726e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ph=E1=BA=A1m=20T=E1=BA=A5n=20Minh=20Ti=E1=BA=BFn?= Date: Sun, 12 Mar 2023 16:41:11 +0700 Subject: [PATCH] wrap quotes to prevent stripping leading 0 --- src/user/admin.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/user/admin.js b/src/user/admin.js index c92035fc47..17dcd318e5 100644 --- a/src/user/admin.js +++ b/src/user/admin.js @@ -70,7 +70,12 @@ module.exports = function (User) { let line = ''; usersData.forEach((user, index) => { - line += `${fields.map(field => user[field]).join(',')}`; + line += `${fields.map(field => { + if ( /^\d+$/.test(user[field])) { + return `'${user[field]}'`; + } + return user[field] + }).join(',')}`; if (showIps) { userIPs = ips[index] ? ips[index].join(',') : ''; line += `,"${userIPs}"\n`;