Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yohobuy-node
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
1
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
王水玲
7 years ago
Commit
f85494b9354c0d36b0fed31f9d0bd839d16276ad
1 parent
bfd3afa1
xss
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
4 deletions
package.json
utils/cleanHtml.js
utils/helpers.js
package.json
View file @
f85494b
{
"name"
:
"yohobuy-node"
,
"version"
:
"6.6.1
2
"
,
"version"
:
"6.6.1
4
"
,
"private"
:
true
,
"description"
:
"A New Yohobuy Project With Express"
,
"repository"
:
{
...
...
utils/cleanHtml.js
View file @
f85494b
...
...
@@ -10,7 +10,7 @@ const htmlEntity = {
};
exports
.
htmlDecode
=
function
(
txt
)
{
txt
=
txt
||
''
;
txt
=
txt
+
''
||
''
;
return
txt
.
replace
(
/
((
&
(([
a-z
][
a-z0-9
]
*
)
|
(
#
[
0-9
]
+
)
|
(
#x
[
0-9a-f
]
+
))
;
)
|
[
"'<>&
])
/gi
,
function
(
s
)
{
s
=
s
||
''
;
const
s1
=
htmlEntity
[
s
.
toLowerCase
()];
...
...
@@ -24,7 +24,8 @@ exports.htmlDecode = function(txt) {
};
exports
.
htmlEncode
=
function
(
str
)
{
str
=
str
||
''
;
str
=
str
+
''
||
''
;
return
str
.
replace
(
re
,
function
(
s
)
{
switch
(
s
)
{
case
'"'
:
...
...
utils/helpers.js
View file @
f85494b
...
...
@@ -87,7 +87,7 @@ module.exports = {
htmlEncode
:
function
(
str
)
{
const
re
=
/
(\r\n)
|
[
"
\'
<>
]
/g
;
str
=
str
||
''
;
str
=
str
+
''
||
''
;
return
str
.
replace
(
re
,
function
(
s
)
{
switch
(
s
)
{
case
'"'
:
...
...
Please
register
or
login
to post a comment