diff options
Diffstat (limited to 'internal/media/util.go')
-rw-r--r-- | internal/media/util.go | 32 |
1 files changed, 16 insertions, 16 deletions
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) } |