Skip to content

Commit

Permalink
sanitize ensure string
Browse files Browse the repository at this point in the history
Signed-off-by: Samuel Hellawell <[email protected]>
  • Loading branch information
cykoder committed Nov 14, 2022
1 parent 72aa7ef commit 22a2f41
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@docknetwork/prettyvc",
"description": "Render pretty verifiable credentials",
"version": "1.3.9",
"version": "1.3.10",
"main": "lib/index.js",
"license": "MIT",
"repository": {
Expand Down
5 changes: 3 additions & 2 deletions src/utils/sanitize.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
export default function sanitize(str) {
if (!str) {
const strValue = str.toString(); // calling tostring incase of numbers
if (!strValue) {
return '';
}
return str.replace(/&/g, '&amp;')
return strValue.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;')
Expand Down

0 comments on commit 22a2f41

Please sign in to comment.