-
-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(permalink): handle invalid permalink setting #384
Conversation
return this.rule.replace(rParam, (match, name) => data[name]); | ||
return this.rule.replace(rParam, (match, name) => { | ||
if (['permalink', 'path'].includes(name)) { | ||
throw new Error('Invalid permalink setting!'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is not the best change, it makes hexo-util
and hexo
being coupled. (Although probably no one uses hexo-util
except hexo
)
Lines 404 to 405 in ec7fd7c
permalink.stringify({year: '2014', month: '01', day: '31', title: 'test'}) | |
// 2014/01/31/test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated the patch to disallow the case where the parameter is a getter. Please take a look to see if this is better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated the patch to disallow the case where the parameter is a getter. Please take a look to see if this is better.
This may affect :tags
and :categories
, but maybe no one will use these two parameters because they can't be overridden by front-matter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your work. it looks better than before
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:tags
or :categories
looks like an array
Fix hexojs/hexo#5263