upload: Rename upload_message_image_from_request.

The table is named Attachment, and not all of them are images.
This commit is contained in:
Alex Vandiver 2023-02-28 03:02:25 +00:00 committed by Tim Abbott
parent bd80c048be
commit 04e7621668
3 changed files with 5 additions and 5 deletions

View File

@ -23,7 +23,7 @@ from zerver.lib.create_user import create_user
from zerver.lib.storage import static_path
from zerver.lib.stream_color import STREAM_ASSIGNMENT_COLORS
from zerver.lib.timestamp import floor_to_day
from zerver.lib.upload import upload_message_image_from_request
from zerver.lib.upload import upload_message_attachment_from_request
from zerver.models import Client, Realm, Recipient, Stream, Subscription, UserGroup, UserProfile
@ -132,7 +132,7 @@ class Command(BaseCommand):
file_info = os.stat(IMAGE_FILE_PATH)
file_size = file_info.st_size
with open(IMAGE_FILE_PATH, "rb") as fp:
upload_message_image_from_request(UploadedFile(fp), shylock, file_size)
upload_message_attachment_from_request(UploadedFile(fp), shylock, file_size)
FixtureData = Mapping[Union[str, int, None], List[int]]

View File

@ -136,7 +136,7 @@ def claim_attachment(
return attachment
def upload_message_image_from_request(
def upload_message_attachment_from_request(
user_file: UploadedFile, user_profile: UserProfile, user_file_size: int
) -> str:
uploaded_file_name, content_type = get_file_info(user_file)

View File

@ -29,7 +29,7 @@ from zerver.lib.response import json_success
from zerver.lib.upload import (
check_upload_within_quota,
get_public_upload_root_url,
upload_message_image_from_request,
upload_message_attachment_from_request,
)
from zerver.lib.upload.base import INLINE_MIME_TYPES
from zerver.lib.upload.local import assert_is_local_storage_path
@ -300,5 +300,5 @@ def upload_file_backend(request: HttpRequest, user_profile: UserProfile) -> Http
)
check_upload_within_quota(user_profile.realm, file_size)
uri = upload_message_image_from_request(user_file, user_profile, file_size)
uri = upload_message_attachment_from_request(user_file, user_profile, file_size)
return json_success(request, data={"uri": uri})