From b1f6ff20efd1021f592bf75c47803c83ab8fc6e4 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Sun, 22 Oct 2023 12:45:03 -0700 Subject: [PATCH] attachments: Correct attachment_id type from string to integer. Signed-off-by: Anders Kaseorg --- zerver/openapi/zulip.yaml | 4 ++-- zerver/views/attachments.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/zerver/openapi/zulip.yaml b/zerver/openapi/zulip.yaml index e7151be305..4bc301481f 100644 --- a/zerver/openapi/zulip.yaml +++ b/zerver/openapi/zulip.yaml @@ -5015,8 +5015,8 @@ paths: description: | The ID of the attachment to be deleted. schema: - type: string - example: "1" + type: integer + example: 1 required: true responses: "200": diff --git a/zerver/views/attachments.py b/zerver/views/attachments.py index e23bacd5c8..7fb88a9074 100644 --- a/zerver/views/attachments.py +++ b/zerver/views/attachments.py @@ -16,8 +16,8 @@ def list_by_user(request: HttpRequest, user_profile: UserProfile) -> HttpRespons ) -def remove(request: HttpRequest, user_profile: UserProfile, attachment_id: str) -> HttpResponse: - attachment = access_attachment_by_id(user_profile, int(attachment_id), needs_owner=True) +def remove(request: HttpRequest, user_profile: UserProfile, attachment_id: int) -> HttpResponse: + attachment = access_attachment_by_id(user_profile, attachment_id, needs_owner=True) remove_attachment(user_profile, attachment) - notify_attachment_update(user_profile, "remove", {"id": int(attachment_id)}) + notify_attachment_update(user_profile, "remove", {"id": attachment_id}) return json_success(request)