Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from Oct 8, 2021
Merged

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

merged 2 commits into from Oct 8, 2021

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.

None yet

3 participants