mirror of https://github.com/status-im/codimd.git
refactor: fix lint on lib/web/userRouter.js
Signed-off-by: BoHong Li <raccoon@hackmd.io>
This commit is contained in:
parent
3049c64066
commit
ee1538eed9
|
@ -69,8 +69,7 @@ UserRouter.get('/me/delete/:token?', function (req, res) {
|
|||
// export the data of the authenticated user
|
||||
UserRouter.get('/me/export', function (req, res) {
|
||||
if (req.isAuthenticated()) {
|
||||
// let output = fs.createWriteStream(__dirname + '/example.zip');
|
||||
let archive = archiver('zip', {
|
||||
const archive = archiver('zip', {
|
||||
zlib: { level: 3 } // Sets the compression level.
|
||||
})
|
||||
res.setHeader('Content-Type', 'application/zip')
|
||||
|
@ -90,14 +89,14 @@ UserRouter.get('/me/export', function (req, res) {
|
|||
ownerId: user.id
|
||||
}
|
||||
}).then(function (notes) {
|
||||
let filenames = {}
|
||||
const filenames = {}
|
||||
async.each(notes, function (note, callback) {
|
||||
let basename = note.title.replace(/\//g, '-') // Prevent subdirectories
|
||||
let filename
|
||||
let suffix = ''
|
||||
let suffix = 0
|
||||
do {
|
||||
let seperator = typeof suffix === 'number' ? '-' : ''
|
||||
filename = basename + seperator + suffix + '.md'
|
||||
const separator = suffix === 0 ? '' : '-'
|
||||
filename = basename + separator + suffix + '.md'
|
||||
suffix++
|
||||
} while (filenames[filename])
|
||||
filenames[filename] = true
|
||||
|
|
Loading…
Reference in New Issue