Skip to content

Commit

Permalink
Merge pull request #5 from imaegoo/patch-2
Browse files Browse the repository at this point in the history
fix(generator): should not encode assets file path
  • Loading branch information
ppoffice committed Mar 17, 2020
2 parents fcc22a7 + d557acd commit 2344514
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/hexo/generator/assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ module.exports = function(hexo) {
return null;
}
return {
path: encodeURI('/' + filepath.replace(/\\/g, '/')),
path: '/' + filepath.replace(/\\/g, '/'),
data: fs.readFileSync(file, { encoding: 'utf-8' })
};
}).filter(file => file !== null);
Expand Down
2 changes: 1 addition & 1 deletion src/hexo/generator/assets.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ test('Export files from asset/ folder that are not in theme\'s source folder', a
const generator = hexo.extend.generator.get('static_assets').bind(hexo);
const result = await generator(locals);
['/js/algolia.js', '/js/google_cse.js'].forEach(file => {
expect(result.find(route => route.path === file)).not.toBeNull();
expect(result.find(route => route.path === file)).not.toBeUndefined();
expect(result.find(route => route.path === file).data)
.toBe(readFileSync(join(assetsDir, file), { encoding: 'utf-8' }));
});
Expand Down

0 comments on commit 2344514

Please sign in to comment.