Handle pasted memo identifiers and explain invalid review input
Assistant: codex Assistant-Model: gpt-6-astra Assistant-Session: 01a09cbb-87c6-7900-a145-4ce53ba9f1a6
This commit is contained in:
parent
2692fa6f13
commit
c70d63abf9
5 changed files with 46 additions and 5 deletions
|
|
@ -72,6 +72,7 @@ class App:
|
|||
messages = {
|
||||
"session_expired": "Your session expired. Sign in again to continue.",
|
||||
"invalid_form": "This form could not be verified. Reopen the review before submitting again.",
|
||||
"invalid_memo_id": "Enter the memo identifier only, for example SECRETS-WP-0010-T03-apply. Do not include a URL or quotation marks.",
|
||||
"policy_denied": "The permission service refused this review action.",
|
||||
"wrong_recipient": "This review is addressed to another person.",
|
||||
"stale_presentation": "The memo changed. Open its current version before taking an action.",
|
||||
|
|
@ -128,10 +129,14 @@ class App:
|
|||
if session is None:
|
||||
raise ReviewError(401, "session_expired")
|
||||
if method == "GET" and path == "/review":
|
||||
params = _one(environ.get("QUERY_STRING", ""))
|
||||
if set(params) != {"memo_id"} or not re.fullmatch(r"[A-Za-z0-9][A-Za-z0-9._:-]{0,255}", params["memo_id"]):
|
||||
raise ValueError("invalid memo id")
|
||||
page = self.review.open(session, params["memo_id"])
|
||||
try:
|
||||
params = _one(environ.get("QUERY_STRING", ""))
|
||||
except (ValueError, UnicodeError):
|
||||
raise ReviewError(400, "invalid_memo_id") from None
|
||||
memo_id = params.get("memo_id", "").strip()
|
||||
if set(params) != {"memo_id"} or not re.fullmatch(r"[A-Za-z0-9][A-Za-z0-9._:-]{0,255}", memo_id):
|
||||
raise ReviewError(400, "invalid_memo_id")
|
||||
page = self.review.open(session, memo_id)
|
||||
return 200, review_page(page, session), "text/html", []
|
||||
match = re.fullmatch(r"/presentations/(pres-[a-f0-9-]{36})(?:/(ack|act|packet/([0-9]{1,3})))?", path)
|
||||
if not match:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue