From cb8688f4298a1a3ed5e28565004588be3c071df0 Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Mon, 20 Dec 2021 15:19:53 +0100 Subject: Remove unnecessary storage config variables (#344) * rewire config to not use extraneous serve vars * rename 'file' to 'local' for consistency * use Type and Size again --- internal/media/util.go | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'internal/media/util.go') diff --git a/internal/media/util.go b/internal/media/util.go index 963e3c93f..147178d08 100644 --- a/internal/media/util.go +++ b/internal/media/util.go @@ -295,28 +295,28 @@ type imageAndMeta struct { // ParseMediaType converts s to a recognized MediaType, or returns an error if unrecognized func ParseMediaType(s string) (Type, error) { - switch Type(s) { - case Attachment: - return Attachment, nil - case Header: - return Header, nil - case Avatar: - return Avatar, nil - case Emoji: - return Emoji, nil + switch s { + case string(TypeAttachment): + return TypeAttachment, nil + case string(TypeHeader): + return TypeHeader, nil + case string(TypeAvatar): + return TypeAvatar, nil + case string(TypeEmoji): + return TypeEmoji, nil } return "", fmt.Errorf("%s not a recognized MediaType", s) } // ParseMediaSize converts s to a recognized MediaSize, or returns an error if unrecognized func ParseMediaSize(s string) (Size, error) { - switch Size(s) { - case Small: - return Small, nil - case Original: - return Original, nil - case Static: - return Static, nil + switch s { + case string(SizeSmall): + return SizeSmall, nil + case string(SizeOriginal): + return SizeOriginal, nil + case string(SizeStatic): + return SizeStatic, nil } return "", fmt.Errorf("%s not a recognized MediaSize", s) } -- cgit v1.2.3