Skip to content
This repository has been archived by the owner on Aug 30, 2023. It is now read-only.

Commit

Permalink
テンプレートのエスケープ処理を修正
Browse files Browse the repository at this point in the history
  • Loading branch information
nsyee-test-member committed Nov 9, 2012
1 parent 0194da1 commit d2cca1b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/utils/index.js
Expand Up @@ -3,16 +3,20 @@ var util = require('util');


exports.nl2br = function(str) {
return str.replace(/\n/g, '<br/>');
if (str) {
return str.replace(/\n/g, '<br/>');
}
};

exports.escHtml = function(str) {
if (str) {
str = str.replace(/&/g, '&amp;');
str = str.replace(/</g, '&lt;');
str = str.replace(/>/g, '&gt;');
str = str.replace(/"/g, '&quot;');
str = str.replace(/\\/g, '&yen;');
return str;
}
};

// Error
Expand Down

0 comments on commit d2cca1b

Please sign in to comment.