Skip to content

Commit

Permalink
Update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
GordonZhang2024 committed May 1, 2024
1 parent 957aa15 commit cd99555
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
6 changes: 3 additions & 3 deletions examples/example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"id": "5f41eab9-0fc3-43eb-add1-18f9ad56dc14",
"execution_count": 1,
"id": "ca6cd635-e99a-499d-bca9-53e60c87fe4c",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"&ampltscript&ampgtalert(&#34&#59Bad.&#34&#59)&#59&amplt/script&ampgt\n"
"<script>alert("Bad.")&#59;</script>\n"
]
}
],
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "xss-shield"
version = "0.0.3"
version = "0.1.1"
authors = [
{ name="Gordon Zhang", email="jp20171211@163.com" },
]
Expand Down
5 changes: 2 additions & 3 deletions src/xss_shield/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
def escape(s: str) -> str:
s = s.replace('<', '&lt;')\
s = s.replace(';', '&#59;')\
.replace('<', '&lt;')\
.replace('>', '&gt;')\
.replace('&', '&amp;')\
.replace(' ', '-')\
.replace("'", "&#39;")\
.replace('"', "&#34;")\
.replace(';', '&#59;')\
.replace('/', '&#47;')\

return s

0 comments on commit cd99555

Please sign in to comment.