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 bug: remove dupliated root path when using asset_img tag #2824

Merged
merged 1 commit into from
Nov 1, 2017

Conversation

darkrasid
Copy link

solving #2123

  • plugin img tag resolve root path twice

on lib/plugin/tag/asset_img.js

  args[i] = url.resolve(ctx.config.root, asset.path);  << first 

and on lib/plugin/tag/img.js

  function makeUrl(path) {
    if (path[0] === '#' || path.substring(0, 2) === '//') {
      return path;
    }

    var data = url.parse(path);

    if (data && data.protocol) {
      return path;
    }

    path = config.root + path;

    return path.replace(/\/{2,}/g, '/'); << second
  }

I think there is no reason to prefix root config twice.

@coveralls
Copy link

coveralls commented Nov 1, 2017

Coverage Status

Coverage remained the same at 97.224% when pulling 407fed8 on darkrasid:fix_img_tag_bug into d40879b on hexojs:master.

Copy link
Collaborator

@JLHwung JLHwung left a comment

Choose a reason for hiding this comment

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

Could you add some test case regarding to #2123? It will prevent any further regression, thank you.

@coveralls
Copy link

coveralls commented Nov 1, 2017

Coverage Status

Coverage remained the same at 97.224% when pulling 39b700b on darkrasid:fix_img_tag_bug into d40879b on hexojs:master.

@darkrasid
Copy link
Author

@JLHwung No problem. I add test case.

@coveralls
Copy link

coveralls commented Nov 1, 2017

Coverage Status

Coverage remained the same at 97.224% when pulling 39b700b on darkrasid:fix_img_tag_bug into d40879b on hexojs:master.

@coveralls
Copy link

coveralls commented Nov 1, 2017

Coverage Status

Coverage remained the same at 97.224% when pulling c14aba3 on darkrasid:fix_img_tag_bug into d40879b on hexojs:master.

@JLHwung
Copy link
Collaborator

JLHwung commented Nov 1, 2017

Thank you so much for you contribution. Hexo can't be rock without contributors like you.

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