Permalink
Browse files

テンプレートのエスケープ処理を修正

  • Loading branch information...
1 parent 0194da1 commit d2cca1b0e18b2b18efcca603719b1a511528f63e @nsyee nsyee committed Nov 9, 2012
Showing with 5 additions and 1 deletion.
  1. +5 −1 lib/utils/index.js
View
@@ -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

0 comments on commit d2cca1b

Please sign in to comment.