upload: Stop requiring callers pass in the file size.

This can be calculated because we have the contents.
This commit is contained in:
Alex Vandiver
2024-06-20 17:52:55 +00:00
committed by Tim Abbott
parent 58a9fe9af1
commit f52a93bc14
12 changed files with 25 additions and 59 deletions

View File

@@ -350,9 +350,7 @@ def deactivate_own_user() -> Dict[str, object]:
@openapi_param_value_generator(["/attachments/{attachment_id}:delete"])
def remove_attachment() -> Dict[str, object]:
user_profile = helpers.example_user("iago")
url = upload_message_attachment(
"dummy.txt", len(b"zulip!"), "text/plain", b"zulip!", user_profile
)
url = upload_message_attachment("dummy.txt", "text/plain", b"zulip!", user_profile)
attachment_id = url.replace("/user_uploads/", "").split("/")[0]
return {"attachment_id": attachment_id}