Skip to content
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 post asset folder issue when link ends with .html #2504

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/models/post_asset.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ module.exports = function(ctx) {
var post = Post.findById(this.post);
if (!post) return;

var reg = new RegExp("html" + "$");
if(reg.test(post.path)) {
var assetPath = post.path.substr(0, post.path.lastIndexOf("."));
return pathFn.join(assetPath, this.slug);
}

// PostAsset.path is file path relative to `public_dir`
// no need to urlescape, #1562
return pathFn.join(post.path, this.slug);
Expand Down