fix: avoid append zero suffix on exporting user data

Signed-off-by: Max Wu <jackymaxj@gmail.com>
This commit is contained in:
Max Wu 2021-05-13 11:57:03 +08:00
parent 37b656df93
commit db5fc5075a
1 changed files with 5 additions and 2 deletions

View File

@ -91,8 +91,11 @@ exports.exportMyData = (req, res) => {
let filename let filename
let suffix = 0 let suffix = 0
do { do {
const separator = suffix === 0 ? '' : '-' if (suffix === 0) {
filename = basename + separator + suffix + '.md' filename = basename + '.md'
} else {
filename = basename + '-' + suffix + '.md'
}
suffix++ suffix++
} while (filenames[filename]) } while (filenames[filename])
filenames[filename] = true filenames[filename] = true