Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Content Security Policy (CSP) Not Implemented (DataBiosphere/azul-private#6) #6483

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Prev Previous commit
Next Next commit
Rename file parameter in swagger_resource()
  • Loading branch information
dsotirho-ucsc committed Oct 5, 2024
commit 983c3ab39d9baecd9b85ce7a9e73a7623117cb4e
12 changes: 6 additions & 6 deletions src/azul/chalice.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,16 +508,16 @@ def swagger_ui(self) -> Response:
headers={'Content-Type': 'text/html'},
body=swagger_ui_html)

def swagger_resource(self, file) -> Response:
if os.sep in file:
raise BadRequestError(file)
def swagger_resource(self, file_name: str) -> Response:
if os.sep in file_name:
raise BadRequestError(file_name)
else:
try:
body = self.load_static_resource('swagger', file)
body = self.load_static_resource('swagger', file_name)
except FileNotFoundError:
raise NotFoundError(file)
raise NotFoundError(file_name)
else:
path = pathlib.Path(file)
path = pathlib.Path(file_name)
content_type = mimetypes.types_map[path.suffix]
return Response(status_code=200,
headers={'Content-Type': content_type},
Expand Down
Loading