From 0b5185aaea57c2c1e743874db8606a819bdce19a Mon Sep 17 00:00:00 2001 From: r3dg33k <2913793+r3dg33k@users.noreply.github.com> Date: Fri, 2 Aug 2024 06:58:38 +0300 Subject: [PATCH] added strip for security --- _plugins/posts-lastmod-hook.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_plugins/posts-lastmod-hook.rb b/_plugins/posts-lastmod-hook.rb index 1fd6ecf..1efa032 100644 --- a/_plugins/posts-lastmod-hook.rb +++ b/_plugins/posts-lastmod-hook.rb @@ -4,10 +4,10 @@ Jekyll::Hooks.register :posts, :post_init do |post| - commit_num = `git rev-list --count HEAD "#{ post.path }"` + commit_num = `git rev-list --count HEAD "#{ post.path }"`.strip if commit_num.to_i > 1 - lastmod_date = `git log -1 --pretty="%ad" --date=iso "#{ post.path }"` + lastmod_date = `git log -1 --pretty="%ad" --date=iso "#{ post.path }"`.strip post.data['last_modified_at'] = lastmod_date end