Skip to content

Commit

Permalink
fixup! mozillaGH-72 Add FormattedPolicyCSPMiddleware
Browse files Browse the repository at this point in the history
  • Loading branch information
DylanYoung committed May 26, 2022
1 parent 3bce755 commit a4e83ed
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion csp/contrib/formatted_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ def build_policy(self, request, response):
request, response,
):
format_kwargs = {
field_name for _, field_name, _, _ in formatter.parse(csp)
# field_name ::= arg_name ("." attribute_name | "[" element_index "]")*
field_name[: next((i for i, c in enumerate(field_name) if c in ".["), None)]
for _, field_name, _, _ in formatter.parse(csp)
if field_name is not None
}
if format_kwargs:
for name in format_kwargs:
Expand Down

0 comments on commit a4e83ed

Please sign in to comment.