Skip to content

fix(url_for): absolute path is processed by relative_url#262

Merged
SukkaW merged 2 commits intohexojs:masterfrom
zkqiang:patch-1
Oct 8, 2021
Merged

fix(url_for): absolute path is processed by relative_url#262
SukkaW merged 2 commits intohexojs:masterfrom
zkqiang:patch-1

Conversation

@zkqiang
Copy link
Contributor

@zkqiang zkqiang commented Oct 8, 2021

The path will be processed by relative_url if you don't judge whether the path is an absolute path first

hexo-util/lib/url_for.js

Lines 19 to 21 in b19468d

if (options.relative) {
return relative_url(this.path, path);
}

eg: url_for('http://hexo.io/favicon.ico') will be processed as ../../http:/hexo.io/favicon.ico

So I think this is a bug

Copy link
Member

@SukkaW SukkaW left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but would you mind adding a unit test case for the change?

@SukkaW SukkaW mentioned this pull request Oct 8, 2021
@zkqiang
Copy link
Contributor Author

zkqiang commented Oct 8, 2021

@SukkaW I added it

@SukkaW SukkaW merged commit 4552552 into hexojs:master Oct 8, 2021
nevilm-lt pushed a commit to nevilm-lt/hexo-util that referenced this pull request Apr 22, 2022
* fix(url_for): absolute path is processed by relative_url

* test: absolute urls are processed by relative_url
nevilm-lt pushed a commit to nevilm-lt/hexo-util that referenced this pull request Apr 22, 2022
* fix(url_for): absolute path is processed by relative_url

* test: absolute urls are processed by relative_url
nevilm-lt pushed a commit to nevilm-lt/hexo-util that referenced this pull request Apr 22, 2022
* fix(url_for): absolute path is processed by relative_url

* test: absolute urls are processed by relative_url
nevilm-lt pushed a commit to nevilm-lt/hexo-util that referenced this pull request Apr 22, 2022
* fix(url_for): absolute path is processed by relative_url

* test: absolute urls are processed by relative_url
himanshiLt pushed a commit to himanshiLt/hexo-util that referenced this pull request Apr 25, 2022
* fix(url_for): absolute path is processed by relative_url

* test: absolute urls are processed by relative_url
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants