diff --git a/lib/hexo/post.ts b/lib/hexo/post.ts index 8e443b0283..66c54d863a 100644 --- a/lib/hexo/post.ts +++ b/lib/hexo/post.ts @@ -348,8 +348,7 @@ class Post { const { config } = ctx; const draftDir = join(ctx.source_dir, '_drafts'); const slug = slugize(data.slug.toString(), { transform: config.filename_case }); - data.slug = slug; - const regex = new RegExp(`^${escapeRegExp(slug)}(?:[^\\/\\\\]+)`); + const regex = new RegExp(`^${escapeRegExp(data.slug.toString())}(?:[^\\/\\\\]+)`); let src = ''; const result: Result = {};