Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
twpl committed Sep 2, 2017
1 parent 81321d8 commit 71be53e
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions lib/orverwriteCache.js
Expand Up @@ -22,16 +22,18 @@ let readCacheFile = ( hexo , option , PLUGIN_NM ) =>
reject( new Error(`[${PLUGIN_NM}] Could not open db.json .`) )
}else{
try{
let db = JSON.parse(fileData.toString("UTF-8"))
let db = (fileData && fileData != "" ? JSON.parse(fileData.toString("UTF-8")) : [])
let taglist = []

for( let p of db.models.Post.entries() ){
if( p[1].hexoIncludeMarkdown && p[1].hexoIncludeMarkdown.markdown){
taglist.push({
source : p[1].source ,
markdown : p[1].hexoIncludeMarkdown.markdown
})
}
if(db && db.models && db.models.Post){
for( let p of db.models.Post.entries() ){
if( p[1].hexoIncludeMarkdown && p[1].hexoIncludeMarkdown.markdown){
taglist.push({
source : p[1].source ,
markdown : p[1].hexoIncludeMarkdown.markdown
})
}
}
}
resolve({
hexo : hexo ,
Expand Down

0 comments on commit 71be53e

Please sign in to comment.