Skip to content

Commit f4bad86

Browse files
committed
Fix path error in Node.js 6
1 parent 1f3aa7f commit f4bad86

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

lib/extend/renderer.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ var pathFn = require('path');
44
var Promise = require('bluebird');
55

66
function getExtname(str) {
7+
if (typeof str !== 'string') return '';
8+
79
var extname = pathFn.extname(str) || str;
810
return extname[0] === '.' ? extname.slice(1) : extname;
911
}

lib/hexo/render.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ var Promise = require('bluebird');
55
var fs = require('hexo-fs');
66

77
function getExtname(str) {
8+
if (typeof str !== 'string') return '';
9+
810
var extname = pathFn.extname(str);
911
return extname[0] === '.' ? extname.slice(1) : extname;
1012
}

lib/plugins/filter/post_permalink.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function postPermalinkFilter(data) {
1111
var meta = {
1212
id: data.id || data._id,
1313
title: data.slug,
14-
name: pathFn.basename(data.slug),
14+
name: typeof data.slug === 'string' ? pathFn.basename(data.slug) : '',
1515
post_title: util.slugize(data.title, {transform: 1}),
1616
year: data.date.format('YYYY'),
1717
month: data.date.format('MM'),

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"bluebird": "^3.4.0",
3434
"chalk": "^1.1.3",
3535
"cheerio": "^0.20.0",
36-
"hexo-cli": "^1.0.1",
36+
"hexo-cli": "^1.0.2",
3737
"hexo-front-matter": "^0.2.2",
3838
"hexo-fs": "^0.1.5",
3939
"hexo-i18n": "^0.2.1",
@@ -46,7 +46,7 @@
4646
"moment-timezone": "^0.5.4",
4747
"nunjucks": "^2.4.2",
4848
"pretty-hrtime": "^1.0.2",
49-
"strip-indent": "^2.0.0",
49+
"strip-indent": "^1.0.1",
5050
"swig": "1.4.2",
5151
"swig-extras": "0.0.1",
5252
"text-table": "^0.2.0",

0 commit comments

Comments
 (0)