Skip to content

Commit

Permalink
Use nh3 to clean the markdown content
Browse files Browse the repository at this point in the history
  • Loading branch information
tomodwyer committed Feb 21, 2024
1 parent 36865a4 commit 60887da
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
3 changes: 2 additions & 1 deletion jobserver/views/projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import itertools
import operator

import nh3
import requests
from django.core.exceptions import PermissionDenied
from django.db.models import Min, OuterRef, Subquery
Expand Down Expand Up @@ -34,7 +35,7 @@ class ProjectDetail(View):

def get(self, request, *args, **kwargs):
project = get_object_or_404(Project, slug=self.kwargs["project_slug"])
project.status_description = markdown(project.status_description)
project.status_description = nh3.clean(markdown(project.status_description))

can_create_workspaces = has_permission(
request.user, "workspace_create", project=project
Expand Down
1 change: 1 addition & 0 deletions requirements.prod.in
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ interactive_templates@https://github.com/opensafely-core/interactive-templates/a
itsdangerous
lxml
markdown
nh3
psycopg[binary]
pydantic
pygments
Expand Down
18 changes: 18 additions & 0 deletions requirements.prod.txt
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,24 @@ marshmallow==3.20.2 \
--hash=sha256:4c1daff273513dc5eb24b219a8035559dc573c8f322558ef85f5438ddd1236dd \
--hash=sha256:c21d4b98fee747c130e6bc8f45c4b3199ea66bc00c12ee1f639f0aeca034d5e9
# via environs
nh3==0.2.15 \
--hash=sha256:0d02d0ff79dfd8208ed25a39c12cbda092388fff7f1662466e27d97ad011b770 \
--hash=sha256:3277481293b868b2715907310c7be0f1b9d10491d5adf9fce11756a97e97eddf \
--hash=sha256:3b803a5875e7234907f7d64777dfde2b93db992376f3d6d7af7f3bc347deb305 \
--hash=sha256:427fecbb1031db085eaac9931362adf4a796428ef0163070c484b5a768e71601 \
--hash=sha256:5f0d77272ce6d34db6c87b4f894f037d55183d9518f948bba236fe81e2bb4e28 \
--hash=sha256:60684857cfa8fdbb74daa867e5cad3f0c9789415aba660614fe16cd66cbb9ec7 \
--hash=sha256:6f42f99f0cf6312e470b6c09e04da31f9abaadcd3eb591d7d1a88ea931dca7f3 \
--hash=sha256:86e447a63ca0b16318deb62498db4f76fc60699ce0a1231262880b38b6cff911 \
--hash=sha256:8d595df02413aa38586c24811237e95937ef18304e108b7e92c890a06793e3bf \
--hash=sha256:9c0d415f6b7f2338f93035bba5c0d8c1b464e538bfbb1d598acd47d7969284f0 \
--hash=sha256:a5167a6403d19c515217b6bcaaa9be420974a6ac30e0da9e84d4fc67a5d474c5 \
--hash=sha256:ac19c0d68cd42ecd7ead91a3a032fdfff23d29302dbb1311e641a130dfefba97 \
--hash=sha256:b1e97221cedaf15a54f5243f2c5894bb12ca951ae4ddfd02a9d4ea9df9e1a29d \
--hash=sha256:bc2d086fb540d0fa52ce35afaded4ea526b8fc4d3339f783db55c95de40ef02e \
--hash=sha256:d1e30ff2d8d58fb2a14961f7aac1bbb1c51f9bdd7da727be35c63826060b0bf3 \
--hash=sha256:f3b53ba93bb7725acab1e030bc2ecd012a817040fd7851b332f86e2f9bb98dc6
# via -r requirements.prod.in
oauthlib==3.2.2 \
--hash=sha256:8139f29aac13e25d502680e9e19963e83f16838d48a0d71c287fe40e7067fbca \
--hash=sha256:9859c40929662bec5d64f34d01c99e093149682a3f38915dc0655d5a633dd918
Expand Down

0 comments on commit 60887da

Please sign in to comment.