ppoffice / hexo-component-inferno

A collection of Inferno.js layout components and utility scripts for Hexo
https://ppoffice.github.io/hexo-component-inferno/
24 stars 30 forks source link

fix(generator): exporting text-based asset files does not work correctly on Windows #4

Closed imaegoo closed 4 years ago

imaegoo commented 4 years ago

Issue

Assets files path are incorrect when running hexo g

Untitled

Test failed

Before

How to fix

Replace \ with / in path. Test passed.

After

imaegoo commented 4 years ago

@ppoffice I rethink about this and have a question, why we need encodeURI here? The file path does not need encodeURI in my understanding.

path: encodeURI('/' + filepath.replace(/\\/g, '/')),
ppoffice commented 4 years ago

@imaegoo Not if the file name contains characters such as spaces (e.g., "js/some file.js").

imaegoo commented 4 years ago

@ppoffice If we create "hexo-component-inferno/assets/js/some file.js", then hexo g, Hexo generator will generate a file named "public/js/some%20file.js", then we push it to web host, the file's URL should be "https://[host]/js/some%2520file.js", that's not what we wish, right?

some file.js

ppoffice commented 4 years ago

@imaegoo True. Would you please create another PR and remove encodeURI?

imaegoo commented 4 years ago

@ppoffice Sure