Skip to content

Commit

Permalink
allow single-quotes in job-comments (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
ansibleguy committed Sep 17, 2024
1 parent 18c16df commit fc4c13f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/ansibleguy-webui/aw/api_endpoints/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ class Meta:
def validate(self, attrs: dict):
for field in Job.api_fields_write:
if field in attrs:
validate_no_xss(value=attrs[field], field=field)
if field in Job.fields_allow_sq:
validate_no_xss(value=attrs[field], field=field, single_quote=True)

else:
validate_no_xss(value=attrs[field], field=field)

return attrs

Expand Down
1 change: 1 addition & 0 deletions src/ansibleguy-webui/aw/model/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ class Job(BaseJob):
api_fields_read.extend(CHANGE_FIELDS)
api_fields_write = api_fields_read.copy()
api_fields_read.append('next_run')
fields_allow_sq = ['comment']

name = models.CharField(max_length=150, null=False, blank=False)
playbook_file = models.CharField(max_length=100)
Expand Down

0 comments on commit fc4c13f

Please sign in to comment.