Skip to content

Commit d3bbdfc

Browse files
committed
fix: can traversal any md files
Signed-off-by: Raccoon <[email protected]>
1 parent bf5325b commit d3bbdfc

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/models/note.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ module.exports = function (sequelize, DataTypes) {
9797
if (!note.alias) {
9898
filePath = config.defaultNotePath
9999
} else {
100-
filePath = path.join(config.docsPath, note.alias + '.md')
100+
filePath = path.join(config.docsPath, path.basename(node.alias) + '.md')
101101
}
102102
if (Note.checkFileExist(filePath)) {
103103
var fsCreatedTime = moment(fs.statSync(filePath).ctime)
@@ -206,7 +206,7 @@ module.exports = function (sequelize, DataTypes) {
206206
}
207207
}).then(function (note) {
208208
if (note) {
209-
const filePath = path.join(config.docsPath, noteId + '.md')
209+
const filePath = path.join(config.docsPath, path.basename(noteId) + '.md')
210210
if (Note.checkFileExist(filePath)) {
211211
// if doc in filesystem have newer modified time than last change time
212212
// then will update the doc in db
@@ -248,7 +248,7 @@ module.exports = function (sequelize, DataTypes) {
248248
return callback(null, note.id)
249249
}
250250
} else {
251-
var filePath = path.join(config.docsPath, noteId + '.md')
251+
var filePath = path.join(config.docsPath, path.basename(noteId) + '.md')
252252
if (Note.checkFileExist(filePath)) {
253253
Note.create({
254254
alias: noteId,

0 commit comments

Comments
 (0)