Navigation Menu

Skip to content

Commit

Permalink
fix: use <%- instead of <%= in user profile page (#1404)
Browse files Browse the repository at this point in the history
  • Loading branch information
XadillaX authored and fengmk2 committed Nov 7, 2018
1 parent 6226ad8 commit 4a3a851
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 1 addition & 3 deletions controllers/web/user/show.js
Expand Up @@ -22,9 +22,7 @@ module.exports = function* showUser(next) {

var data = {
name: name,
email: user.email ? he.encode(user.email, {
encodeEverything:true
}): user.email,
email: user.email ? he.encode(user.email, { encodeEverything: true }) : user.email,
json: user.json || {},
isNpmUser: user.isNpmUser,
};
Expand Down
6 changes: 4 additions & 2 deletions test/controllers/web/user/show.test.js
Expand Up @@ -77,10 +77,12 @@ describe('controllers/web/user/show.test.js', function () {
.get('/~cnpmjstest10')
.expect(200)
.then(function (res) {
assert(res.text.includes("fengmk2@gmail.com") === false);
assert(res.text.includes('fengmk2@gmail.com') === false);

// he.enclde('fengmk2@gmail.com') ↓
assert(res.text.includes('&#x66;&#x65;&#x6E;&#x67;&#x6D;&#x6B;&#x32;&#x40;&#x67;&#x6D;&#x61;&#x69;&#x6C;&#x2E;&#x63;&#x6F;&#x6D;'));
done()
});
});

});
});
2 changes: 1 addition & 1 deletion view/web/profile.html
Expand Up @@ -14,7 +14,7 @@ <h2>
<span style="color:#09f;"><%= user.name %></span>
<% } %>
<% if (user.email) { %>
<small><<a href="mailto:<%= user.email %>"><%= user.email %></a>></small>
<small><<a href="mailto:<%- user.email %>"><%- user.email %></a>></small>
<% } %>
<% if (user.json.fullname) { %>
<small>(<%= user.json.fullname %>)</small>
Expand Down

0 comments on commit 4a3a851

Please sign in to comment.