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

Check for required querystring parameters, handle invalid values #21

Merged
merged 1 commit into from
Sep 3, 2024

Conversation

hancush
Copy link
Member

@hancush hancush commented Aug 27, 2024

Description

This PR resolves a class of Sentry errors arising from bad requests to the PIC endpoints. I'm fairly certain these requests are made by bots, because I've done an audit of the PIC links constructed in the code, and they are formed correctly.

This PR also applies Black formatting to app.py and pins Werkzeug for compatibility with Flask.

Connects Metro-Records/la-metro-councilmatic#1149

Comment on lines +83 to +90
if not query or not set(query.keys()) == {"document_url", "filename"}:
abort(400)

document_url, = query['document_url']
filename, = query['filename']
try:
(document_url,) = query["document_url"]
(filename,) = query["filename"]
except ValueError:
abort(400)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are the only code changes.

@hancush hancush requested a review from antidipyramid August 27, 2024 21:32
@hancush hancush merged commit aeafb3c into master Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants