Closed stevenjoezhang closed 2 months ago
git clone -b post_link https://github.com/hexojs/hexo.git
cd hexo
npm install
npm test
Totals | |
---|---|
Change from base Build 8578073587: | -0.001% |
Covered Lines: | 9326 |
Relevant Lines: | 9370 |
Help, when will the package be updated?
fail to pass test on Windows because of backslash (%5c
)
try: https://github.com/hexojs/hexo/blob/f5e0f92eda9491116c585142c565efcf7bf7a3e3/lib/theme/index.ts#L53
git clone -b post_link https://github.com/hexojs/hexo.git
cd hexo
npm install
npm test
@uiolee I have made the modification, and indeed, I haven't found a more elegant solution. In the future, we can consider adding this path replacement inside url_for
. The WHATWG URL Standard is capable of handling such paths.
> new URL('\\a\\b\\', 'http://example.com').pathname
'/a/b/'
Yes. I noticed that hexo uses different styles of paths in different places. Maybe we should use the same style of paths everywhere so we can avoid conversions
I think we can introduce a new convention: In the database models used by Hexo (including Asset, Page, Post, etc.), the source
attribute is used to specify the file system path under the source directory, which includes backslashes (\
) on Windows; whereas the path
attribute is used to specify their paths on the web, where backslashes should be replaced by /
.
Database model Asset
also contains an _id
attribute (instead of using the UUID automatically assigned by warehouse), which by default is the file's relative path. I have found that when using it, backslashes are replaced, which seems unnecessary. I will try to continue with the refactoring.
Another issue is that when calculating relative paths, sometimes substring
is used and sometimes relative
is used. This inconsistency also needs to be addressed and fixed in the future.
What does it do?
Issue resolved: https://github.com/hexojs/hexo/issues/5383
Screenshots
Pull request tasks