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: undefined escape at #836 #843

Merged
merged 1 commit into from
Sep 13, 2016
Merged

fix: undefined escape at #836 #843

merged 1 commit into from
Sep 13, 2016

Conversation

atian25
Copy link
Contributor

@atian25 atian25 commented Sep 12, 2016

@@ -119,6 +119,7 @@ var filters = {
if(str instanceof r.SafeString) {
return str;
}
if (str == null) str = '';
Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

if(value === null || value === undefined || value === false) {

render('{{ foo }}', { foo: false }) should render false or empty string ?

@vecmezoni vecmezoni self-assigned this Sep 12, 2016
@fengmk2
Copy link

fengmk2 commented Sep 13, 2016

@atian25 should fix safe filter bug too.

@@ -1395,6 +1395,10 @@
expect(res).to.be('&><\'"');
});

render('{{ foo }}', { foo: null }, { autoescape: true }, function (err, res) {
expect(res).to.be('');
});
Copy link

Choose a reason for hiding this comment

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

add render('{{ foo | safe }}', { foo: '<html>' }, { autoescape: true } test for safe filter.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@atian25
Copy link
Contributor Author

atian25 commented Sep 13, 2016

@vecmezoni updated.

question:

if(value === null || value === undefined || value === false) {

render('{{ foo }}', { foo: false }) should render false or empty string ?

@fengmk2
Copy link

fengmk2 commented Sep 13, 2016

boolean value should follow toString() logic.

@atian25
Copy link
Contributor Author

atian25 commented Sep 13, 2016

@fengmk2 agree. updated.

@@ -119,10 +119,12 @@ var filters = {
if(str instanceof r.SafeString) {
return str;
}
str = (str === null || str === undefined) ? '' : str;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you please fix normalize function and remove false from there and use normalize here.
I don't see any idea behind it

Copy link
Contributor Author

@atian25 atian25 Sep 13, 2016

Choose a reason for hiding this comment

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

maybe another PR. This one is focus at quick bug fix.
I'm afraid it(change normalize) will cause BREAK CHANGE.

Copy link
Collaborator

Choose a reason for hiding this comment

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

ok, i'll merge it to 2.x, please prepare pull request for master

Copy link
Collaborator

Choose a reason for hiding this comment

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

could you rebase this branch on 2.x?

Copy link
Contributor Author

@atian25 atian25 Sep 13, 2016

Choose a reason for hiding this comment

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

ok, hold on

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@vecmezoni plz review again. The ci is fail, but local test is ok, could you trigger it again?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I can't trigger CI, you can change commit hash and push it with force. It would trigger Appveyour

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@vecmezoni done, travis is pass.

@vecmezoni vecmezoni changed the base branch from master to 2.x September 13, 2016 06:50
@vecmezoni vecmezoni changed the base branch from 2.x to master September 13, 2016 06:50
@atian25 atian25 changed the base branch from master to 2.x September 13, 2016 07:00
@vecmezoni vecmezoni merged commit 7671d29 into mozilla:2.x Sep 13, 2016
@vecmezoni
Copy link
Collaborator

Merged. Waiting for master branch fix.

@vecmezoni
Copy link
Collaborator

2.5.1 released, cherry-picked this patch to master.

return r.markSafe(lib.escape(str.toString()));
},

safe: function(str) {
str = (str === null || str === undefined) ? '' : str;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

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