summaryrefslogtreecommitdiff
path: root/internal/media/util.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2021-12-20 15:19:53 +0100
committerLibravatar GitHub <noreply@github.com>2021-12-20 15:19:53 +0100
commitcb8688f4298a1a3ed5e28565004588be3c071df0 (patch)
tree038b196e914b949857bf8b7c00f22374408bc1ca /internal/media/util.go
parentreturn first offer when no accept header set (#351) (diff)
downloadgotosocial-cb8688f4298a1a3ed5e28565004588be3c071df0.tar.xz
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
Diffstat (limited to 'internal/media/util.go')
-rw-r--r--internal/media/util.go32
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)
}